index previous next




file name: sockdgrm.hpp, sockdgrm.cpp
classification: simulation
contents: class CDatagramInterface, derived from class CSocket, class CDatagramServer, derived from class CDatagramInterface, class CDatagramClient, derived from class CDatagramInterface
use: an interface to datagram sockets, plus server and client sockets


global items used by the classes:


class CDatagramInterface:

 CDatagramInterface (ACSocketAddress* addr, INT32 sid): Stores the address and socket ID. Assumes that a datagram socket with the ID sid exists and is open. If addr is NULL, an assert fails.

 CDatagramInterface (ACSocketAddress *addr): Stores the address of the socket. If addr is NULL, an assert fails.

 EBool ReceiveMessage (void *data, INT32 *size): Reads the data from the socket (assumes that data points to a buffer of size *size). Blocks according to the internal timeout. Modifies *size to reflect the number of bytes read. Returns True if the receive operation was successful, else False. If data or size is NULL, an assert fails.

 EBool SendMessage (void *data, INT32 size): Transmits the message over the socket. Returns True if the operation was successful, else False. If data is NULL, an assert fails.


class CDatagramServer:

Use this socket class to create a datagram socket. When the class is deleted, the socket is closed and unlinked if necessary.

 CDatagramServer (ACSocketAddress *addr): Creates the datagram socket. If addr is NULL, an assert fails.

 virtual ~CDatagramServer (): Closes the socket and unlinks it if it has the address family AF_UNIX.


class CDatagramClient:

Use this socket class to identify an existing datagram socket.

 CDatagramClient (ACSocketAddress *addr): Identifies the socket. If addr is NULL, an assert fails.


last modified: Fri Feb 5 18:56:33 1999