TCP server: accept connections as TcpStream.
More...
#include <tcpServer.hpp>
TCP server: accept connections as TcpStream.
- Author
- Vincent Lachenal
- Since
- 0.2
◆ TcpServer()
| anch::network::TcpServer::TcpServer |
( |
const std::string & | host, |
|
|
uint16_t | port, |
|
|
int | backlog = SOMAXCONN ) |
TcpServer constructor: bind and listen
- Parameters
-
| host | the local host name or numeric address (empty for any address) |
| port | the local port (0 for an ephemeral port: see getAddress ) |
| backlog | the maximum number of pending connections |
- Exceptions
-
◆ accept()
Wait for a connection
- Parameters
-
| bufSize | the stream buffer size |
- Returns
- the connection stream
- Exceptions
-
◆ acceptSocket()
Wait for a connection (the socket can be moved to another thread, and a TcpStream built from it)
- Parameters
-
| peer | if not NULL , receives the peer address |
- Returns
- the connected socket
- Exceptions
-
◆ getAddress()
Local address getter (useful for ephemeral port)
- Returns
- the address
- Exceptions
-
◆ getSocket()
Listening socket getter
- Returns
- the socket
The documentation for this class was generated from the following file: