#include <mcs.hh>
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 () |
ServerSocket & | operator= (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. |
mcs::ServerSocket::ServerSocket | ( | const ServerSocket & | ) |
Declared to avoid using of default copy constructor.
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.
interface | Name of the network interface to be used as server; | |
port | Port on which the server should listen. |
FATAL | MSG_CALLING_BIND; | |
FATAL | MSG_CALLING_LISTEN; |
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.
newsock | Upon return will contain the newly created C socket; | |
millisec | Timeout in millisec. |
ServerSocket& mcs::ServerSocket::operator= | ( | const ServerSocket & | ) |
Declared to avoid using of default assignment operator.
int mcs::ServerSocket::sockfd [private] |
SSL_CTX* mcs::ServerSocket::ssl_ctx [private] |
bool mcs::ServerSocket::use_ssl [private] |
![]() |
MCS (My Customizable Server) ver. 0.3.3-alpha3
|