C++ common classes
General purpose classes for use across projects (Apache license)
CUDPSocket Class Reference

CUDPSocket.h: interface for the CUDPSocket class. More...

#include <CUDPSocket.h>

Inheritance diagram for CUDPSocket:
CBaseSocket CXPlatThread

List of all members.

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]

Detailed Description

CUDPSocket.h: interface for the CUDPSocket class.

_MSC_VER > 1000 UDP socket class

Definition at line 33 of file CUDPSocket.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
DATA_BUFFER_SIZE 

Definition at line 47 of file CUDPSocket.h.


Constructor & Destructor Documentation

Definition at line 26 of file CUDPSocket.cpp.

CUDPSocket::~CUDPSocket ( ) [virtual]

Definition at line 30 of file CUDPSocket.cpp.


Member Function Documentation

Close socket.

Reimplemented from CBaseSocket.

Definition at line 173 of file CUDPSocket.cpp.

BOOL CUDPSocket::Create ( UINT  nPort = 0,
LPCSTR  lpAddr = NULL,
BOOL  bReuse = TRUE,
BOOL  bBind = TRUE 
) [virtual]
Parameters:
lpAddrPort
bReuseInet address in the standard xxx.xxx.xxx.xxx format
bBindAllow 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.

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.


Member Data Documentation

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.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines