00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef __NETCP_H
00029 #define __NETCP_H
00030
00031
00032
00033 #include "base.h"
00034 #include "socket.h"
00035
00036 #include <string>
00037
00038
00045 namespace NeoEngine
00046 {
00047
00048
00049
00050 class Thread;
00051
00052
00053
00054
00060 class NEOENGINE_API TCPSocket : public Socket
00061 {
00062 public:
00063
00065 int m_iSocket;
00066
00068 Thread *m_pkAcceptThread;
00069
00070
00071
00075 TCPSocket( SocketCallback *pkCallback = 0 );
00076
00081 TCPSocket( int iSocket, SocketCallback *pkCallback = 0 );
00082
00085 virtual ~TCPSocket();
00086
00093 virtual bool Listen( int iPort, SocketCallback *pkCallback );
00094
00101 virtual bool Connect( const std::string &rstrAddr, int iPort );
00102
00109 int Read( void *pDst, int iBytes );
00110
00117 int Write( const void *pSrc, int iBytes );
00118
00122 virtual int GetFD() { return m_iSocket; }
00123
00128 virtual void SetBlocking( bool bBlock = false );
00129
00135 virtual unsigned int Poll( int iTimeout );
00136 };
00137
00138
00139
00140 };
00141
00142
00143
00144 #endif