Página principal | Lista alfabética | Lista de componentes | Lista de archivos | Miembros de las clases | Archivos de los miembros | Páginas relacionadas

Servidor.hpp

Ir a la documentación de este archivo.
00001 
00006 /*
00007    MUnDoCAAD MUD Engine
00008    Copyright (C) 2002-2005 José Manuel Ferrer Ortiz
00009 
00010    *****************************************************************************
00011    *                                                                           *
00012    *  This program is free software; you can redistribute it and/or modify it  *
00013    *  under the terms of the GNU General Public License version 2, as          *
00014    *  published by the Free Software Foundation.                               *
00015    *                                                                           *
00016    *  This program is distributed in the hope that it will be useful, but      *
00017    *  WITHOUT ANY WARRANTY; without even the implied warranty of               *
00018    *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU         *
00019    *  General Public License version 2 for more details.                       *
00020    *                                                                           *
00021    *  You should have received a copy of the GNU General Public License        *
00022    *  version 2 along with this program; if not, write to the Free Software    *
00023    *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA  *
00024    *                                                                           *
00025    *****************************************************************************
00026 */
00027 
00028 
00029 #ifndef _SERVIDOR_HPP
00030 #define _SERVIDOR_HPP
00031 
00032 
00033 #include <QHash>
00034 #include <QTcpServer>
00035 #include <QTcpSocket>
00036 
00037 
00039 class Conexion : public QTcpSocket
00040 {
00041   Q_OBJECT
00042 
00043   public:
00044     Conexion  (int descriptor);  // Constructor
00045     ~Conexion ();                // Destructor
00046 
00047     void Escribe (const QString &texto);
00048 
00049   signals:
00050     void EliminarConexion (Conexion *con);
00051 
00052   private slots:
00053     void ConexionCerrada ();
00054     void Lee             ();
00055 
00056   public:
00058     int      descriptor;
00060     QString *direccion;
00061 };
00062 
00064 class Servidor : public QTcpServer
00065 {
00066   Q_OBJECT
00067 
00068   public:
00069     Servidor  ();  // Constructor
00070     ~Servidor ();  // Destructor
00071 
00072     void CierraConexion     (const int descriptor);
00073     void Escribe            (const int descriptor, const QString &texto);
00074     void incomingConnection (int descriptor);
00075 
00076   private:
00078     QHash<int, Conexion *> conexiones;
00079 
00080   private slots:
00081     void EliminarConexion (Conexion *con);
00082 };
00083 
00084 
00085 #endif  // _SERVIDOR_HPP

Generado el Tue Nov 29 01:04:33 2005 para MUnDoCAAD MUD Engine por  doxygen 1.4.4