C++ common classes
General purpose classes for use across projects (Apache license)
|
CUDPSocket.h: interface for the CUDPSocket class. More...
#include <CUDPSocket.h>
Public Types | |
enum | { DATA_BUFFER_SIZE = 0x800 } |
Public Member Functions | |
CUDPSocket () | |
virtual | ~CUDPSocket () |
virtual BOOL | Create (UINT nPort=0, LPCSTR lpAddr=NULL, BOOL bReuse=TRUE, BOOL bBind=TRUE) |
virtual int | SendMsg (unsigned char *lpData, int iLength, char *pIPAddress, int iPort) |
Default to bind the socket. | |
virtual void | SetBroadcastMode (BOOL bOn=TRUE) |
virtual void | CloseSocket () |
Close socket. | |
void | StopThread () |
Protected Member Functions | |
virtual unsigned | WorkerFunction (void *pParam) |
Called by CXPlatThread to start work in object context. | |
virtual int | HandleReceiveData () |
virtual void | ProcessData (unsigned char *lpData, int iLength, struct sockaddr_in *addrFrom)=0 |
call back to receive data | |
Static Protected Member Functions | |
static unsigned _stdcall | ReceiveDataThread (void *pVoid) |
Protected Attributes | |
CXPlatEvent | cStopEvent |
pure virturl, process received data | |
unsigned char | ucBuffer [DATA_BUFFER_SIZE] |
CUDPSocket.h: interface for the CUDPSocket class.
_MSC_VER > 1000 UDP socket class
Definition at line 33 of file CUDPSocket.h.
anonymous enum |
Definition at line 47 of file CUDPSocket.h.
Definition at line 26 of file CUDPSocket.cpp.
CUDPSocket::~CUDPSocket | ( | ) | [virtual] |
Definition at line 30 of file CUDPSocket.cpp.
void CUDPSocket::CloseSocket | ( | ) | [virtual] |
BOOL CUDPSocket::Create | ( | UINT | nPort = 0 , |
LPCSTR | lpAddr = NULL , |
||
BOOL | bReuse = TRUE , |
||
BOOL | bBind = TRUE |
||
) | [virtual] |
lpAddr | Port |
bReuse | Inet address in the standard xxx.xxx.xxx.xxx format |
bBind | Allow reuse of this socket |
Definition at line 35 of file CUDPSocket.cpp.
int CUDPSocket::HandleReceiveData | ( | ) | [protected, virtual] |
Definition at line 65 of file CUDPSocket.cpp.
virtual void CUDPSocket::ProcessData | ( | unsigned char * | lpData, |
int | iLength, | ||
struct sockaddr_in * | addrFrom | ||
) | [protected, pure virtual] |
call back to receive data
static unsigned _stdcall CUDPSocket::ReceiveDataThread | ( | void * | pVoid | ) | [static, protected] |
int CUDPSocket::SendMsg | ( | unsigned char * | lpData, |
int | iLength, | ||
char * | pIPAddress, | ||
int | iPort | ||
) | [virtual] |
Default to bind the socket.
Definition at line 142 of file CUDPSocket.cpp.
void CUDPSocket::SetBroadcastMode | ( | BOOL | bOn = TRUE | ) | [virtual] |
Definition at line 188 of file CUDPSocket.cpp.
Definition at line 179 of file CUDPSocket.cpp.
unsigned CUDPSocket::WorkerFunction | ( | void * | pParam | ) | [protected, virtual] |
Called by CXPlatThread to start work in object context.
Implements CXPlatThread.
Definition at line 44 of file CUDPSocket.cpp.
CXPlatEvent CUDPSocket::cStopEvent [protected] |
pure virturl, process received data
Definition at line 57 of file CUDPSocket.h.
unsigned char CUDPSocket::ucBuffer[DATA_BUFFER_SIZE] [protected] |
Definition at line 58 of file CUDPSocket.h.