All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
net::SocketHandler Class Reference

Base Class with basic convenience support for its derived classes. More...

#include <SocketHandler.h>

Inheritance diagram for net::SocketHandler:
Inheritance graph
[legend]

Public Member Functions

 SocketHandler (Port port)
 

Static Public Attributes

static const int GENERIC_SOCKET_ERROR = -1
 
static const int DEFAULT_SOCKET_DESCRIPTOR = -1
 
static const Port DEFAULT_INVALID_PORT = -1
 

Protected Member Functions

int getLastErrorCode ()
 
bool closeSocket (int descriptor)
 

Protected Attributes

Port serverPort
 
SocketState currentState
 

Static Protected Attributes

static const int MESSAGE_BUFFER_SIZE = 8192
 
static const char END_OF_MESSAGE = 3
 

Detailed Description

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.

Member Function Documentation

bool SocketHandler::closeSocket ( int  descriptor)
protected

Wrapper function to close a socket regardless the underlying platform.

Parameters
descriptorThe 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.

Member Data Documentation

SocketState net::SocketHandler::currentState
protected

Server port, required by both client and server sides.


The documentation for this class was generated from the following files: