Menu

TCPServer

Majenko Technologies

The TCPServer object acts as an endpoint to a collection of TCPClient objects which are allocated on a per-client connection basis.

You set up the socket initially with:

TCPServer mySocket;

and add it to the network stack:

Network.addPort(mySocket);

You can then tell it to listen for incoming connections on a specific port:

mySocket.listen(10000);

When an incoming connection is detected it is automatically established - you don't have to actively accept it.

Accessing the individual client connections within the socket is performed with the select() method. This cycles through the available incoming connections one at a time returning the [TCPClient] object for each one. You treat these just the same as if you had created them as outgoing connections with the same methods.

To do:
* peerPort() and peerAddress() methods


Related

Wiki: TCPClient

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.