tcp_connection_server


An os_tcp_connection_server accepts incoming TCP connections on a particular address. This class should be used in conjunction with os_tcp_socket .

Library

Network<ToolKit>

Declaration

#include <ospace/socket/tcpsrvr.h>

class os_tcp_connection_server : public os_socket

Interface

Constructor
os_tcp_connection_server( const os_socket_address& address , int backlog )
Constructs a TCP socket bound to address and capable of serving a backlog maximum of backlog (default 5 ) incoming connections.

Throws: os_network_toolkit_error

Constructor
os_tcp_connection_server( os_sock_t descriptor )
Constructs a socket based on the native operating system socket descriptor .

Throws: os_network_toolkit_error

accept
bool accept( os_tcp_socket& socket , timeval* time_out )
Extracts the first pending connection request and associates it with socket socket . If socket is already open, closes it first. If an error occurs or if the socket is in non-blocking mode and no connections are pending, returns false ; otherwise, returns true . If time_out  is 0 (default) then blocks indefinitely until a connection is accepted.

Throws: os_network_toolkit_error

listen
void listen( int backlog )
Sets the maximum backlog (default 5 ) of incoming connections to backlog .

Throws: os_network_toolkit_error


Copyright©1994-2026 Recursion Software LLC
All Rights Reserved - For use by licensed users only.