Claw
1.7.3
|
Class used to receive incoming connections. More...
#include <socket_server.hpp>
Public Member Functions | |
socket_server () | |
Constructor. | |
socket_server (int port, unsigned int queue_size=s_default_queue_size) | |
Constructor, open the socket. | |
socket_server * | open (int port, unsigned int queue_size=s_default_queue_size) |
Open the socket. | |
socket_server * | close () |
Close the socket. | |
bool | is_open () const |
Tell if the server is open. | |
operator bool () const | |
Tell if the server is working. | |
template<typename SocketStream > | |
void | accept (SocketStream &sock, int time_limit) |
Accept an incoming connection. |
Static Public Member Functions | |
static bool | init () |
Initialize the use of the socket library. | |
static bool | release () |
Close the socket library. |
Additional Inherited Members | |
Private Member Functions inherited from claw::net::basic_socket | |
basic_socket () | |
Constructor. | |
basic_socket * | open () |
Open the socket. | |
basic_socket * | close () |
Close the socket. | |
bool | is_open () const |
Tell if the socket is open. |
Class used to receive incoming connections.
Definition at line 47 of file socket_server.hpp.
claw::net::socket_server::socket_server | ( | ) |
claw::net::socket_server::socket_server | ( | int | port, |
unsigned int | queue_size = s_default_queue_size |
||
) |
Constructor, open the socket.
port | The port to bind. |
queue_size | The size of the waiting queue for incoming connections. |
Definition at line 49 of file socket_server.cpp.
void claw::net::socket_server::accept | ( | SocketStream & | sock, |
int | time_limit | ||
) |
Accept an incoming connection.
sock | (out) The socket created for this connection. |
time_limit | Maximum of seconds to wait before considering there won't be any connection. if time_limit is negative, the server wait until there is a connection. |
Definition at line 41 of file socket_server.tpp.
References claw::socket_traits_unix::accept(), claw::net::basic_socket::m_descriptor, and claw::socket_traits_unix::select_read().
|
static |
Initialize the use of the socket library.
Definition at line 112 of file socket_server.cpp.
References claw::socket_traits_unix::init().
claw::net::socket_server * claw::net::socket_server::open | ( | int | port, |
unsigned int | queue_size = s_default_queue_size |
||
) |
Open the socket.
port | The port to bind. |
queue_size | The size of the waiting queue for incoming connections. |
Definition at line 62 of file socket_server.cpp.
References claw::net::basic_socket::close(), claw::socket_traits_unix::listen(), and claw::net::basic_socket::open().
|
static |
Close the socket library.
Definition at line 122 of file socket_server.cpp.
References claw::socket_traits_unix::release().