socket.h

00001 /***************************************************************************
00002                           socket.h  -  description
00003                              -------------------
00004     begin                : mer mar 22 2006
00005     copyright            : (C) 2006 by Sylvain Archenault <sylvain.archenault@laposte.net>
00006                                        Yves Houpert <yves.houpert@insa-rouen.fr>
00007 
00008  ***************************************************************************/
00009 
00010 /***************************************************************************
00011  *                                                                         *
00012  *   This program is free software; you can redistribute it and/or modify  *
00013  *   it under the terms of the GNU General Public License as published by  *
00014  *   the Free Software Foundation; either version 2 of the License, or     *
00015  *   (at your option) any later version.                                   *
00016  *                                                                         *
00017  ***************************************************************************/
00018 #ifndef SOCKET_H
00019 #define SOCKET_H
00020 #include <qsocket.h>
00021 #include <qdatastream.h>
00022 
00023 class SocketManager;
00024 
00030 class Socket: public QObject
00031 {
00032   Q_OBJECT
00033 public:
00038   Socket(SocketManager& rSocketManager, QObject* parent = 0);
00039 
00041   ~Socket();
00042 
00047   void connectToHost(const std::string& hostname, const int port);
00048 
00055   Socket& operator <<(const std::string& xmlMessage);
00056 
00058   void close();
00059 
00060 private slots:
00062   void socketReadyRead();
00063 
00065   void socketConnected();
00066 
00068   void socketClosed();
00069 
00072   void socketError( int e );
00073 
00075   void closeConnection();
00076 
00077 private:
00079   SocketManager& m_rSocketManager;
00081   QSocket* m_pSocket;
00083   QDataStream m_OutputStream;
00085   char* m_pBuffer;
00088   static const size_t BUFFER_SIZE;
00090   static const size_t MAX_SIZE;
00091 };
00092 
00093 #endif

Generated on Fri May 19 12:15:54 2006 for Bamboo Ch@t by  doxygen 1.4.6