34 #ifndef ASYNC_TCP_SERVER_INCLUDED 35 #define ASYNC_TCP_SERVER_INCLUDED 46 #include <sigc++/sigc++.h> 126 template <
typename ConT=TcpConnection>
154 return dynamic_cast<ConT*
>(con);
168 sigc::signal<void, ConT*, typename ConT::DisconnectReason>
173 uint16_t remote_port)
175 ConT *con =
new ConT(sock, remote_addr, remote_port);
176 con->disconnected.connect(
183 void onDisconnected(ConT *con,
typename ConT::DisconnectReason reason)
A class for handling exiting TCP connections.
virtual ~TcpServer(void)
Destructor.
sigc::signal< void, ConT *, typename ConT::DisconnectReason > clientDisconnected
A signal that is emitted when a client disconnect from the server.
virtual void createConnection(int sock, const IpAddress &remote_addr, uint16_t remote_port)
TcpServer(const std::string &port_str, const Async::IpAddress &bind_ip=IpAddress())
Default constuctor.
The base class for creating a TCP server.
TcpConnection * getClient(unsigned int index)
Get the client object pointer from the server.
void removeConnection(TcpConnection *con)
sigc::signal< void, ConT * > clientConnected
A signal that is emitted when a client connect to the server.
A class for creating a TCP server.
void addConnection(TcpConnection *con)
Namespace for the asynchronous programming classes.
ConT * getClient(unsigned int index)
Get the client object pointer from the server.
A class for representing an IP address in an OS independent way.
The base class for creating a TCP server.