Base Class with basic convenience support for its derived classes.
More...
#include <SocketHandler.h>
|
| SocketHandler (Port port) |
|
|
static const int | GENERIC_SOCKET_ERROR = -1 |
|
static const int | DEFAULT_SOCKET_DESCRIPTOR = -1 |
|
static const Port | DEFAULT_INVALID_PORT = -1 |
|
|
static const int | MESSAGE_BUFFER_SIZE = 8192 |
|
static const char | END_OF_MESSAGE = 3 |
|
Base Class with basic convenience support for its derived classes.
This class provides mainly wrapper functions to hide the differences between UNIX and Win32, such as socket closing and error codes receiving. Client and server are supposed to extend this class to add their specific features.
bool SocketHandler::closeSocket |
( |
int |
descriptor | ) |
|
|
protected |
Wrapper function to close a socket regardless the underlying platform.
- Parameters
-
descriptor | The socket descriptor. |
- Returns
- true if the operation succeeds, false otherwise.
int SocketHandler::getLastErrorCode |
( |
| ) |
|
|
protected |
Socket current state. Wrapper function to get the system calls error codes regardless the underlying platform.
- Returns
- The last error code returned by a failed system call.
Server port, required by both client and server sides.
The documentation for this class was generated from the following files: