Implementation of the TCP server.