claw 1.9.0
 
Loading...
Searching...
No Matches
claw::net::socket_server Class Reference

Class used to receive incoming connections. More...

#include <socket_server.hpp>

Inheritance diagram for claw::net::socket_server:
Collaboration diagram for claw::net::socket_server:

Public Member Functions

 socket_server ()
 Constructor.
 
 socket_server (int port, unsigned int queue_size=s_default_queue_size)
 Constructor, open the socket.
 
socket_serveropen (int port, unsigned int queue_size=s_default_queue_size)
 Open the socket.
 
socket_serverclose ()
 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)
 

Static Public Member Functions

static bool init ()
 Initialize the use of the socket library.
 
static bool release ()
 Close the socket library.
 

Detailed Description

Class used to receive incoming connections.

Author
Julien Jorge

Definition at line 48 of file socket_server.hpp.

Constructor & Destructor Documentation

◆ socket_server() [1/2]

claw::net::socket_server::socket_server ( )

Constructor.

Postcondition
is_open() == false

Definition at line 38 of file socket_server.cpp.

◆ socket_server() [2/2]

claw::net::socket_server::socket_server ( int port,
unsigned int queue_size = s_default_queue_size )

Constructor, open the socket.

Parameters
portThe port to bind.
queue_sizeThe size of the waiting queue for incoming connections.

Definition at line 48 of file socket_server.cpp.

Member Function Documentation

◆ close()

claw::net::socket_server * claw::net::socket_server::close ( )

Close the socket.

Definition at line 78 of file socket_server.cpp.

◆ init()

bool claw::net::socket_server::init ( )
static

Initialize the use of the socket library.

Returns
true if the initialization is successful.

Definition at line 106 of file socket_server.cpp.

◆ is_open()

bool claw::net::socket_server::is_open ( ) const

Tell if the server is open.

Definition at line 89 of file socket_server.cpp.

◆ open()

claw::net::socket_server * claw::net::socket_server::open ( int port,
unsigned int queue_size = s_default_queue_size )

Open the socket.

Parameters
portThe port to bind.
queue_sizeThe size of the waiting queue for incoming connections.
Returns
this if everything works fine, NULL otherwise.

Definition at line 60 of file socket_server.cpp.

◆ operator bool()

claw::net::socket_server::operator bool ( ) const

Tell if the server is working.

Definition at line 97 of file socket_server.cpp.

◆ release()

bool claw::net::socket_server::release ( )
static

Close the socket library.

Returns
true if the operation is successful.

Definition at line 115 of file socket_server.cpp.


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