bitz-server
0.1.6
|
#include <socket.h>
Public Member Functions | |
UDPSocket () throw (SocketException) | |
UDPSocket (unsigned short localPort) throw (SocketException) | |
UDPSocket (const string &localAddress, unsigned short localPort) throw (SocketException) | |
void | disconnect () throw (SocketException) |
void | sendTo (const void *buffer, int bufferLen, const string &foreignAddress, unsigned short foreignPort) throw (SocketException) |
int | recvFrom (void *buffer, int bufferLen, string &sourceAddress, unsigned short &sourcePort) throw (SocketException) |
void | setMulticastTTL (unsigned char multicastTTL) throw (SocketException) |
void | joinGroup (const string &multicastGroup) throw (SocketException) |
void | leaveGroup (const string &multicastGroup) throw (SocketException) |
![]() | |
void | connect (const string &foreignAddress, unsigned short foreignPort) throw (SocketException) |
void | send (const void *buffer, int bufferLen) throw (SocketException) |
int | recv (void *buffer, int bufferLen) throw (SocketException) |
int | peek (void *buffer, int bufferLen) throw (SocketException) |
int | readLine (char *buffer, int bufferLen, const char delimiter= '\n') throw (SocketException) |
string | getForeignAddress () throw (SocketException) |
unsigned short | getForeignPort () throw (SocketException) |
![]() | |
~Socket () | |
string | getLocalAddress () throw (SocketException) |
unsigned short | getLocalPort () throw (SocketException) |
void | setLocalPort (unsigned short localPort) throw (SocketException) |
void | setLocalAddressAndPort (const string &localAddress, unsigned short localPort=0) throw (SocketException) |
Additional Inherited Members | |
![]() | |
static void | cleanUp () throw (SocketException) |
static unsigned short | resolveService (const string &service, const string &protocol="tcp") |
![]() | |
CommunicatingSocket (int type, int protocol) throw (SocketException) | |
CommunicatingSocket (int newSD) | |
![]() | |
Socket (int type, int protocol) throw (SocketException) | |
Socket (int sock) | |
![]() | |
int | sock |
UDP socket class
socketlibrary::UDPSocket::UDPSocket | ( | ) | ||
throw | ( | SocketException | ||
) |
Construct a UDP socket
SocketException | thrown if unable to create UDP socket |
socketlibrary::UDPSocket::UDPSocket | ( | unsigned short | localPort | ) | |
throw | ( | SocketException | |||
) |
Construct a UDP socket with the given local port
localPort | local port |
SocketException | thrown if unable to create UDP socket |
socketlibrary::UDPSocket::UDPSocket | ( | const string & | localAddress, |
unsigned short | localPort | ||
) | |||
throw | ( | SocketException | |
) |
Construct a UDP socket with the given local port and address
localAddress | local address |
localPort | local port |
SocketException | thrown if unable to create UDP socket |
void socketlibrary::UDPSocket::disconnect | ( | ) | ||
throw | ( | SocketException | ||
) |
Unset foreign address and port
SocketException | thrown if unable to disconnect UDP socket |
void socketlibrary::UDPSocket::joinGroup | ( | const string & | multicastGroup | ) | |
throw | ( | SocketException | |||
) |
Join the specified multicast group
multicastGroup | multicast group address to join |
SocketException | thrown if unable to join group |
void socketlibrary::UDPSocket::leaveGroup | ( | const string & | multicastGroup | ) | |
throw | ( | SocketException | |||
) |
Leave the specified multicast group
multicastGroup | multicast group address to leave |
SocketException | thrown if unable to leave group |
int socketlibrary::UDPSocket::recvFrom | ( | void * | buffer, |
int | bufferLen, | ||
string & | sourceAddress, | ||
unsigned short & | sourcePort | ||
) | |||
throw | ( | SocketException | |
) |
Read read up to bufferLen bytes data from this socket. The given buffer is where the data will be placed
buffer | buffer to receive data |
bufferLen | maximum number of bytes to receive |
sourceAddress | address of datagram source |
sourcePort | port of data source |
SocketException | thrown if unable to receive datagram |
void socketlibrary::UDPSocket::sendTo | ( | const void * | buffer, |
int | bufferLen, | ||
const string & | foreignAddress, | ||
unsigned short | foreignPort | ||
) | |||
throw | ( | SocketException | |
) |
Send the given buffer as a UDP datagram to the specified address/port
buffer | buffer to be written |
bufferLen | number of bytes to write |
foreignAddress | address (IP address or name) to send to |
foreignPort | port number to send to |
SocketException | thrown if unable to send datagram |
void socketlibrary::UDPSocket::setMulticastTTL | ( | unsigned char | multicastTTL | ) | |
throw | ( | SocketException | |||
) |
Set the multicast TTL
multicastTTL | multicast TTL |
SocketException | thrown if unable to set TTL |