|
bitz-server
0.1.6
|
#include <socket.h>
Public Member Functions | |
| 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) |
Public Member Functions inherited from socketlibrary::Socket | |
| ~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) |
Protected Member Functions | |
| CommunicatingSocket (int type, int protocol) throw (SocketException) | |
| CommunicatingSocket (int newSD) | |
Protected Member Functions inherited from socketlibrary::Socket | |
| Socket (int type, int protocol) throw (SocketException) | |
| Socket (int sock) | |
Additional Inherited Members | |
Static Public Member Functions inherited from socketlibrary::Socket | |
| static void | cleanUp () throw (SocketException) |
| static unsigned short | resolveService (const string &service, const string &protocol="tcp") |
Protected Attributes inherited from socketlibrary::Socket | |
| int | sock |
Socket which is able to connect, send, and receive
| void socketlibrary::CommunicatingSocket::connect | ( | const string & | foreignAddress, |
| unsigned short | foreignPort | ||
| ) | |||
| throw | ( | SocketException | |
| ) | |||
Establish a socket connection with the given foreign address and port
| foreignAddress | foreign address (IP address or name) |
| foreignPort | foreign port |
| SocketException | thrown if unable to establish connection |
| string socketlibrary::CommunicatingSocket::getForeignAddress | ( | ) | ||
| throw | ( | SocketException | ||
| ) | ||||
Get the foreign address. Call connect() before calling recv()
| SocketException | thrown if unable to fetch foreign address |
| unsigned short socketlibrary::CommunicatingSocket::getForeignPort | ( | ) | ||
| throw | ( | SocketException | ||
| ) | ||||
Get the foreign port. Call connect() before calling recv()
| SocketException | thrown if unable to fetch foreign port |
| int socketlibrary::CommunicatingSocket::peek | ( | void * | buffer, |
| int | bufferLen | ||
| ) | |||
| throw | ( | SocketException | |
| ) | |||
Read into the given buffer up to bufferLen bytes data from this socket but don't remove the read bytes from the socket read buffer. Call connect() before calling peek()
| buffer | buffer to receive the data |
| bufferLen | maximum number of bytes to read into buffer |
| SocketException | thrown if unable to receive data |
| int socketlibrary::CommunicatingSocket::readLine | ( | char * | buffer, |
| int | bufferLen, | ||
| const char | delimiter = '\n' |
||
| ) | |||
| throw | ( | SocketException | |
| ) | |||
Read a line into the given buffer from this socket. Call connect() before calling recv()
| buffer | buffer to receive the data |
| bufferLen | maximum number of bytes to read into buffer |
| delimiter | (optional) end of line delimiter |
| SocketException | thrown if unable to receive data |
| int socketlibrary::CommunicatingSocket::recv | ( | void * | buffer, |
| int | bufferLen | ||
| ) | |||
| throw | ( | SocketException | |
| ) | |||
Read into the given buffer up to bufferLen bytes data from this socket. Call connect() before calling recv()
| buffer | buffer to receive the data |
| bufferLen | maximum number of bytes to read into buffer |
| SocketException | thrown if unable to receive data |
| void socketlibrary::CommunicatingSocket::send | ( | const void * | buffer, |
| int | bufferLen | ||
| ) | |||
| throw | ( | SocketException | |
| ) | |||
Write the given buffer to this socket. Call connect() before calling send()
| buffer | buffer to be written |
| bufferLen | number of bytes from buffer to be written |
| SocketException | thrown if unable to send data |
1.8.9.1