MCS
0.3.3-alpha7
|
Manage TCP server sockets. More...
#include <mcs.hh>
Public Member Functions | |
bool | acceptConnection (int &newsock, unsigned int millisec) |
Wait for an incoming connection. More... | |
void * | getSSLContext () |
ServerSocket & | operator= (const ServerSocket &) |
Declared to avoid using of default assignment operator. More... | |
ServerSocket (const ServerSocket &) | |
Declared to avoid using of default copy constructor. More... | |
ServerSocket (string interface, unsigned short int port, bool use_ssl=false, string sslcert="", string sslpriv="") | |
Constructor. More... | |
~ServerSocket () | |
Destructor. More... | |
![]() | |
unsigned int | count () |
Return how many network interfaces are present in the system. More... | |
unsigned int | index () |
Return the index of the actual interface. More... | |
string | ipaddress (int index=-1) |
Return the IP address of an interface. More... | |
string | name (int index=-1) |
Return the name of an interface. More... | |
NetInterface (string name="lo") | |
Constructor. More... | |
NetInterface (const NetInterface &) | |
Declared to avoid using of default copy constructor. More... | |
NetInterface & | operator= (const NetInterface &) |
Declared to avoid using of default assignment operator. More... | |
~NetInterface () | |
Destructor. More... | |
Private Attributes | |
int | sockfd |
Server socket descriptor. More... | |
bool | use_ssl |
True if the connection should be encrypted. More... | |
Additional Inherited Members | |
![]() | |
int | getflags () |
bool | isup () |
int | req (int ioctl_num, struct ifreq *ifr) |
void | str_sockaddr (struct sockaddr *sa) |
void | str_sockaddr_in (struct sockaddr_in *sin) |
![]() | |
unsigned int | lindex |
vector< string > | names |
Vector containing the name of all interfaces present in the system. More... | |
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.
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.
|
private |
|
private |
![]() |
MCS (My Customizable Server) ver. 0.3.3-alpha7
|