In file socket.hxx:

class ODatagramSocket : public OSocket

A connectionless socket to send and receive datagrams

Inheritance:


Public Methods

ODatagramSocket (TAddrFamily Family= af_inet, TProtocol Protocol= protocol_ip, TSocketType Type= sock_dgram)
Creates a datagram socket
ODatagramSocket (const ODatagramSocket& Socket)
Copy constructor
int recvFrom (void* pBuffer, int BufferSize, OSocketAddr* pSenderAddr= 0, TSocketMsgFlag Flag= msg_normal)
Tries to receives BufferSize data from the socket, if no error occurs
int sendTo (const OSocketAddr& ReceiverAddr, const void* pBuffer, int BufferSize, TSocketMsgFlag Flag= msg_normal)
Tries to send one datagram with BytesToSend data to the given ReceiverAddr
~ODatagramSocket ()
Destructor

Inherited from OSocket:

Public Methods

Boolean bind(const OSocketAddr& LocalInterface)
int clearError()
void close()
Boolean enableNonBlockingMode(Boolean On= True)
TSocketError getError()
void getError(char* pBuffer, int nSize)
void getLocalAddr(OSocketAddr& Addr)
const char* getLocalHost()
int getLocalPort()
int getOption(TSocketOption Option, void* pBuffer, int BufferLen, TSocketOptionLevel Level= sol_socket)
void getPeerAddr(OSocketAddr& Addr)
const char* getPeerHost()
int getPeerPort()
TSocketType getType()
Boolean isExceptionPending(int wp_sec, int wp_usec = 0)
Boolean isRecvReady(int wp_sec, int wp_usec = 0)
Boolean isSendReady(int wp_sec, int wp_usec = 0)
Boolean isValid()
operator oslSocket()
operator oslSocket()
int setBroadcast(int opt = -1)
int setDebug(int opt = -1)
int setDontRoute(int opt = -1)
int setKeepAlive(int opt = -1)
int setLinger(int time = -1)
int setOobinline(int opt = -1)
Boolean setOption(TSocketOption Option, void* pBuffer, int BufferLen, TSocketOptionLevel Level= sol_socket)
int setRecvBufSize(int size =-1)
int setRecvTimeout(int time= -1)
int setReuseAddr(int opt = -1)
int setSendBufSize(int size =-1)
int setSendTimeout(int time= -1)
int setTcpNoDelay(int sz =-1)

Inherited from ISocketTypes:


Documentation

A connectionless socket to send and receive datagrams
ODatagramSocket(TAddrFamily Family= af_inet, TProtocol Protocol= protocol_ip, TSocketType Type= sock_dgram)
Creates a datagram socket
Parameters:
Type - is sock_dgram by default.

ODatagramSocket(const ODatagramSocket& Socket)
Copy constructor

~ODatagramSocket()
Destructor. Closes the socket.

int recvFrom(void* pBuffer, int BufferSize, OSocketAddr* pSenderAddr= 0, TSocketMsgFlag Flag= msg_normal)
Tries to receives BufferSize data from the socket, if no error occurs.
Returns:
the number of received bytes.
Parameters:
pSenderAddr - [out] You must provide pointer to a SocketAddr. It will be filled with the address of the datagrams sender. If pSenderAddr is 0, it is ignored.
pBuffer - [out] Points to a buffer that will be filled with the received datagram.
BufferSize - [in] The size of pBuffer.
Flag - [in] Modifier for the call. Valid values are:
  • msg_normal,
  • msg_oob,
  • msg_peek,
  • msg_dontroute,
  • msg_maxiovlen,

int sendTo(const OSocketAddr& ReceiverAddr, const void* pBuffer, int BufferSize, TSocketMsgFlag Flag= msg_normal)
Tries to send one datagram with BytesToSend data to the given ReceiverAddr. Since we only send one packet, we don't need to concern ourselfes here with incomplete sends due to packet boundaries.
Returns:
the number of transfered bytes.
Parameters:
ReceiverAddr - [in] A SocketAddr that contains the destination address for this send.
pBuffer - [in] Points to a buffer that contains the send-data.
BufferSize - [in] The number of bytes to send. pBuffer must have at least this size.
Flag - [in] Modifier for the call. Valid values are:
  • msg_normal,
  • msg_oob,
  • msg_peek,
  • msg_dontroute,
  • msg_maxiovlen,


This class has no child classes.

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de