userver: components::TcpAcceptorBase Class Reference
Loading...
Searching...
No Matches
components::TcpAcceptorBase Class Referenceabstract

#include <userver/components/tcp_acceptor_base.hpp>

Detailed Description

Component for accepting incoming TCP connections.

Each accepted socket is processed in a new coroutine by ProcessSocket of the derived class.

Static options:

Name Description Default value
port port to listen on -
unix-socket unix socket to listen on instead of listening on a port ''
task_processor task processor to accept incoming connections -
backlog max count of new connections pending acceptance 1024
no_delay whether to set the TCP_NODELAY option on incoming sockets true
sockets_task_processor task processor to process accepted sockets value of task_processor
See also
TCP half-duplex server with static configs validation
Examples
samples/tcp_full_duplex_service/tcp_full_duplex_service.cpp, and samples/tcp_service/tcp_service.cpp.

Definition at line 41 of file tcp_acceptor_base.hpp.

+ Inheritance diagram for components::TcpAcceptorBase:
+ Collaboration diagram for components::TcpAcceptorBase:

Public Member Functions

 TcpAcceptorBase (const ComponentConfig &, const ComponentContext &)
 
- Public Member Functions inherited from components::LoggableComponentBase
 LoggableComponentBase (const ComponentConfig &, const ComponentContext &)
 
 LoggableComponentBase (LoggableComponentBase &&)=delete
 
 LoggableComponentBase (const LoggableComponentBase &)=delete
 
 ~LoggableComponentBase () override=default
 
ComponentHealth GetComponentHealth () const override
 
void OnLoadingCancelled () override
 
void OnAllComponentsLoaded () override
 
void OnAllComponentsAreStopping () override
 

Static Public Member Functions

static yaml_config::Schema GetStaticConfigSchema ()
 
- Static Public Member Functions inherited from components::LoggableComponentBase
static yaml_config::Schema GetStaticConfigSchema ()
 

Protected Member Functions

virtual void ProcessSocket (engine::io::Socket &&sock)=0
 

Member Function Documentation

◆ ProcessSocket()

virtual void components::TcpAcceptorBase::ProcessSocket ( engine::io::Socket && sock)
protectedpure virtual

Override this function to process incoming sockets.

Warning
The function is called concurrently from multiple threads on each new socket.

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