Logo
~Sockets~
~Examples~
~Contact~


SlaveSocket.h

Go to the documentation of this file.
00001 #ifndef _SLAVESOCKET_H
00002 #define _SLAVESOCKET_H
00003 
00004 #include "BaseSocket.h"
00005 
00006 
00007 class InternalSocket;
00008 
00009 class SlaveSocket : public BaseSocket
00010 {
00011 public:
00012         SlaveSocket(ISocketHandler&);
00013         ~SlaveSocket();
00014 
00015         void OnConnect() {
00016 printf("Connected to %s:%u\n", GetRemoteAddress().c_str(), GetRemotePort());
00017                 TcpSocket::OnConnect();
00018         }
00019         void OnRead();
00020 
00021         void OpenConnection();
00022         void CloseConnection();
00023         void SendPacket();
00024 
00025         InternalSocket *GetSock(unsigned short id);
00026 
00027         port_t GetHostPort(const std::string& header,std::string& host);
00028 
00029 private:
00030         SlaveSocket(const SlaveSocket& s) : BaseSocket(s) {} // copy constructor
00031         SlaveSocket& operator=(const SlaveSocket& ) { return *this; } // assignment operator
00032         unsigned short m_ip;
00033         short m_command;
00034         short m_length;
00035         char m_packet[32000];
00036         size_t m_packet_ptr;
00037         int m_state;
00038 };
00039 
00040 
00041 
00042 
00043 #endif // _SLAVESOCKET_H
Page, code, and content Copyright (C) 2006 by Anders Hedström
Generated on Mon Aug 29 20:21:47 2005 for C++ Sockets by  doxygen 1.4.4