mcs::ServerSocket Class Reference

#include <mcs.hh>

Inheritance diagram for mcs::ServerSocket:

Inheritance graph
[legend]

List of all members.


Detailed Description

Manage TCP server sockets.

This class implements a TCP server socket, that is an object that wait for a client connection to arrive, using the acceptConnection() method. When this connection is established the method returns the new socket descriptor.

Definition at line 2050 of file mcs.hh.


Public Member Functions

bool acceptConnection (int &newsock, unsigned int millisec)
 Wait for an incoming connection.
void * getSSLContext ()
ServerSocketoperator= (const ServerSocket &)
 Declared to avoid using of default assignment operator.
 ServerSocket (string interface, unsigned short int port, bool use_ssl=false, string sslcert="", string sslpriv="")
 Constructor.
 ServerSocket (const ServerSocket &)
 Declared to avoid using of default copy constructor.
 ~ServerSocket ()
 Destructor.

Private Attributes

int sockfd
 Server socket descriptor.
SSL_CTX * ssl_ctx
 Pointer to the global SSL context object.
bool use_ssl
 True if the connection should be encrypted.

Constructor & Destructor Documentation

mcs::ServerSocket::ServerSocket ( const ServerSocket  ) 

Declared to avoid using of default copy constructor.

Warning:
This constructor is declared but not implemented. If you try to use it you will get a compilation error.

mcs::ServerSocket::ServerSocket ( string  interface,
unsigned short int  port,
bool  use_ssl = false,
string  sslcert = "",
string  sslpriv = "" 
)

Constructor.

This constructor create a server socket using the interface and port specified as arguments.

Parameters:
interface Name of the network interface to be used as server;
port Port on which the server should listen.
Exceptions:
FATAL MSG_CALLING_BIND;
FATAL MSG_CALLING_LISTEN;

Definition at line 798 of file Socket.cc.

mcs::ServerSocket::~ServerSocket (  ) 

Destructor.

Definition at line 850 of file Socket.cc.


Member Function Documentation

bool mcs::ServerSocket::acceptConnection ( int &  newsock,
unsigned int  millisec 
)

Wait for an incoming connection.

This method will wait until an incoming connection arrives or a timeout occur. When the connection arrives it returns the newly created C socket descriptor through the "newsock" parameter.

Parameters:
newsock Upon return will contain the newly created C socket;
millisec Timeout in millisec.
Returns:
True if a new connection arrived, false if a timeout occurred.

Definition at line 877 of file Socket.cc.

ServerSocket& mcs::ServerSocket::operator= ( const ServerSocket  ) 

Declared to avoid using of default assignment operator.

Warning:
This operator is declared but not implemented. If you try to use it you will get a compilation error.


Member Data Documentation

int mcs::ServerSocket::sockfd [private]

Server socket descriptor.

Definition at line 2054 of file mcs.hh.

SSL_CTX* mcs::ServerSocket::ssl_ctx [private]

Pointer to the global SSL context object.

Definition at line 2061 of file mcs.hh.

bool mcs::ServerSocket::use_ssl [private]

True if the connection should be encrypted.

Definition at line 2057 of file mcs.hh.


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

MCS (My Customizable Server) ver. 0.3.3-alpha3
Documentation generated on Thu Mar 22 13:22:23 UTC 2012