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 #ifndef __NEUDP_H
00028 #define __NEUDP_H
00029
00030
00031
00032 #include "base.h"
00033 #include "socket.h"
00034
00035 #include <string>
00036
00037
00043 namespace NeoEngine
00044 {
00045
00046
00047
00048 class Thread;
00049
00050
00051
00052
00058 class NEOENGINE_API UDPSocket : public Socket
00059 {
00060 public:
00061
00063 int m_iSocket;
00064
00066 std::string m_strTargetAddr;
00067
00069 int m_iTargetPort;
00070
00074 UDPSocket( SocketCallback *pkCallback = 0 );
00075
00080 UDPSocket( int iSocket, SocketCallback *pkCallback = 0 );
00081
00084 virtual ~UDPSocket();
00085
00092 virtual bool Listen( int iPort, SocketCallback *pkCallback );
00093
00100 virtual bool Connect( const std::string &rstrAddr, int iPort );
00101
00111 int Read( void *pDst, int iBytes, std::string &rstrFromAddr, int &riFromPort );
00112
00119 int Write( const void *pSrc, int iBytes );
00120
00124 virtual int GetFD() { return m_iSocket; }
00125
00130 virtual void SetBlocking( bool bBlock = false );
00131
00137 virtual unsigned int Poll( int iTimeout );
00138 };
00139
00140
00141 };
00142
00143
00144
00145 #endif