Skip to content

ATcpServerSocket#

TCP server socket.

Header:#include <AUI/Network/ATcpServerSocket.h>
CMake:aui_link(my_target PUBLIC aui::network)

Detailed Description#

Binds to the given port on all interfaces upon construction and hands out an ATcpSocket per incoming connection.

ATcpServerSocket server(8080);
for (;;) {
    _<ATcpSocket> client = server.accept(); // blocks
    // talk to the client
}

accept() blocks, so a server normally runs it in a dedicated thread (see AThread) and serves each client from a worker. See TCP client and server.

Public Methods#

accept#


_<ATcpSocket> ATcpServerSocket::accept()

Blocks the thread until next connection.

Returns
new connection