ReplicaNet and RNLobby  1
Public Member Functions | Static Public Member Functions | List of all members
XPSocketUrgent Class Reference

#include <XPSocketUrgentClass.h>

Inheritance diagram for XPSocketUrgent:
Inheritance graph
[legend]
Collaboration diagram for XPSocketUrgent:
Collaboration graph
[legend]

Public Member Functions

int Create (const int port=XPSOCK_PORT_ANY)
 
int Create (const XPAddress &addr)
 
int MakeBroadcast (void)
 
int Send (const char *data, const XPAddress &addr)
 
int Send (const char *data, const int len, const XPAddress &addr)
 
int Recv (char *const data, const int maxlen, XPAddress *const addr)
 
- Public Member Functions inherited from XPSocket
 XPSocket ()
 
virtual ~XPSocket ()
 
virtual int Create (void)
 
int Connect (const XPAddress &addr)
 
int Send (const char *data)
 
int Send (const char *data, const int len)
 
int Recv (char *const data, const int maxlen)
 
int Close (void)
 
int Listen (const int port=XPSOCK_PORT_ANY)
 
int Listen (const XPAddress &addr)
 
XPSocketAccept (void)
 
int SetSendBuffer (const int size)
 
int SetRecvBuffer (const int size)
 
int GetAddress (XPAddress *const addr)
 
int GetPeerAddress (XPAddress *const addr)
 
int MutateSocket (XPSocket *socket)
 
bool IsAlive (void)
 
t_XPSocketGetSocketPointer (void)
 

Static Public Member Functions

static int GetMaxPacketSize (void)
 
- Static Public Member Functions inherited from XPSocket
static int GetLastError (void)
 
static int GetMaxPacketSize (void)
 

Detailed Description

An extension to the normal XPSocket class that handles urgent but unreliable packets. This call also makes use of the function in the XPSocket base class Most member functions return an XPSOCK_EERROR code. XPSOCK_EOK indicates no error. XPSOCK_EWOULDBLOCK is a non-fatal error and means the socket operation would have blocked the current thread at this point. If XPSOCK_EERROR is returned the user should use XPSocket::GetLastError() to find out the actual error code

Member Function Documentation

int Create ( const int  port = XPSOCK_PORT_ANY)

Creates an urgent socket. Communication through this socket is faster but less reliable. A mechanism is supplied to enable data to be sent in a reliable manner but at the expense of CPU time and network bandwidth Returns XPSOCK_EERROR if an error occurred If port is zero (0) or XPSOCK_PORT_ANY then the network layer will pick a port number to be bound to Using a value of zero for the port when operating a client is advised since the any chosen port might already be in use

Returns
returns a pointer to new socket or an XPSOCK_EERROR error code.

References XPSock_UrgentCreate().

int Create ( const XPAddress addr)

Creates an urgent socket bound to a specific address. Please see Create(const int port) for more information.

References XPSock_UrgentCreate().

static int GetMaxPacketSize ( void  )
inlinestatic

Returns the maximum size for a packet

Returns
the maximum size for a data packet for this socket
int MakeBroadcast ( void  )

Makes an urgent socket broadcast capable

Returns
returns an XPSOCK error code.

References XPSock_UrgentMakeBroadcast().

int Recv ( char *const  data,
const int  maxlen,
XPAddress *const  addr 
)

Receives data from an urgent socket

Parameters
datapointer to a data buffer
maximumlength of the data buffer
addrthe address of the sending socket for any data received
Returns
returns the length of the data received or 0 if no data pending or an XPSOCK_EERROR error code

References XPSock_UrgentRecv().

int Send ( const char *  data,
const XPAddress addr 
)

Sends a NULL terminated string to the peer (the connected machine) for this socket

Parameters
dataThe pointer to the NULL terminated string
Returns
returns an XPSOCK_EERROR code.

References XPSock_UrgentSend().

int Send ( const char *  data,
const int  len,
const XPAddress addr 
)

Send an urgent packet from the socket to the specified address. The data sent is not guaranteed to arrive at the destination. This will return XPSOCK_EUDPSENDFAILED if this method doesn't exist. If so use a non-urgent socket

Parameters
datathe pointer to the data to send
lenthe length of the data to send
theaddress and port number to send to
Returns
returns an XPSOCK_EERROR error code.

References XPSock_UrgentSend().