ONPOSIX
2.0
|
Socket server for connection-oriented communications. More...
#include <StreamSocketServer.hpp>
Public Member Functions | |
StreamSocketServer (const uint16_t port, int maxPendingConnections=STREAM_MAX_PENDING_CONNECTIONS) | |
Constructor for TCP connection-oriented sockets. | |
StreamSocketServer (const std::string &name, int maxPendingConnections=STREAM_MAX_PENDING_CONNECTIONS) | |
Constructor for local connection-oriented sockets. | |
virtual | ~StreamSocketServer () |
Destructor. | |
void | close () |
Close the descriptor. | |
int | getDescriptorNumber () const |
Method to get descriptor number. |
Private Member Functions | |
StreamSocketServer (const StreamSocketServer &) | |
StreamSocketServer & | operator= (const StreamSocketServer &) |
Private Attributes | |
int | fd_ |
Number of the file descriptor. |
Socket server for connection-oriented communications.
This class corresponds to a socket created with socket(), that must be given to the constructor of StreamSocketServerDescriptor to accept incoming connections.
Definition at line 47 of file StreamSocketServer.hpp.
|
private |
StreamSocketServer | ( | const uint16_t | port, |
int | maxPendingConnections = STREAM_MAX_PENDING_CONNECTIONS |
||
) |
Constructor for TCP connection-oriented sockets.
This constructor creates a connection-oriented AF_INET socket. It calls socket()+bind()+listen(). If the protocol is a stream, it also calls listen().
port | Port of the socket |
runtime_error | in case of error in socket(), bind() or listen() |
Definition at line 77 of file StreamSocketServer.cpp.
StreamSocketServer | ( | const std::string & | name, |
int | maxPendingConnections = STREAM_MAX_PENDING_CONNECTIONS |
||
) |
Constructor for local connection-oriented sockets.
This constructor creates a connection-oriented AF_UNIX socket. It calls socket()+bind()+listen().
name | Name of the local socket on the filesystem |
runtime_error | in case of error in socket(), bind() or listen() |
Definition at line 37 of file StreamSocketServer.cpp.
|
inlinevirtual |
Destructor.
It just calls close() to close the descriptor.
Definition at line 72 of file StreamSocketServer.hpp.
|
inline |
Close the descriptor.
Definition at line 79 of file StreamSocketServer.hpp.
|
inline |
Method to get descriptor number.
Definition at line 88 of file StreamSocketServer.hpp.
|
private |
|
private |
Number of the file descriptor.
This is the return value of socket().
Definition at line 57 of file StreamSocketServer.hpp.