29#ifndef Pt_Net_TcpServer_h
30#define Pt_Net_TcpServer_h
32#include <Pt/Net/Api.h>
33#include <Pt/System/Selectable.h>
67 {
return _deferAccept; }
204 {
return _connectionPending; }
212 const TcpServerImpl& impl()
const
216 TcpServerImpl& impl()
234 TcpServerImpl* _impl;
Host and service address.
Definition Endpoint.h:77
TCP server listen options.
Definition TcpServer.h:46
TcpServerOptions(int backlog=5)
Creates options with accept backlog backlog.
int acceptDeferred() const
Returns the deferred-accept timeout in seconds, or -1 if unset.
Definition TcpServer.h:66
void setDeferAccept(int n)
Sets deferred accept to wait at most n seconds for data.
Definition TcpServer.h:71
~TcpServerOptions()
Destroys the options.
TcpServerOptions(const TcpServerOptions &opts)
Copies the options.
int backlog() const
Returns the accept backlog size.
Definition TcpServer.h:76
TcpServerOptions & operator=(const TcpServerOptions &opts)
Assigns the options.
void setBacklog(int backlog)
Sets the accept backlog size.
Definition TcpServer.h:81
void beginAccept()
Begins accepting a connection.
TcpServer(const Endpoint &ep)
Creates a server and listens on ep.
virtual void onCancel()
Blocks until operation has cancelled.
~TcpServer()
Destroys the server.
void close()
Closes the server and stops listening.
TcpServer(System::EventLoop &loop)
Creates a server and attaches it to loop.
void listen(const Endpoint &ep, const TcpServerOptions &options)
Listens on ep with options.
virtual bool onRun()
Check if ready and run.
virtual void onDetach(System::EventLoop &loop)
Detached from loop.
System::EventLoop * loop() const
Returns the parent event loop.
Definition TcpServer.h:208
virtual void onAttach(System::EventLoop &loop)
Attached to loop.
TcpServer()
Creates a closed server.
void listen(const Endpoint &ep)
Listens on local endpoint ep.
Signal< TcpServer & > & connectionPending()
Returns the signal that a connection is pending.
Definition TcpServer.h:203
Multicast Signal to call multiple slots.
Definition Signal.h:190
Event loop of a thread or process.
Definition EventLoop.h:83
Operation that runs through an event loop.
Definition Selectable.h:60
uint_type uint32_t
Unsigned 32-bit integer type.
Definition Api-Types.h:52
TCP and UDP network sockets.
Definition Client.h:45
Core module.
Definition Allocator.h:33