Cellular Devices (B-Series SoM, Tracker SoM, Tracker One, Boron, E404X, E-Series, and Electron):

Cellular devices (Boron, B-Series SoM, Tracker SoM, Electron, E-Series) do not support TCPServer. The cellular modem does not support it, and also the mobile carriers do not support it. You can only make outgoing TCP connections (TCPClient) on cellular devices.

TCPServer server = TCPServer(port);

Create a server that listens for incoming connections on the specified port.

Parameters: port: the port to listen on (int)


// telnet defaults to port 23
TCPServer server = TCPServer(23);
TCPClient client;

void setup()
  // start listening for clients

  // Make sure your Serial Terminal app is closed before powering your device
  // Wait for a USB serial connection for up to 30 seconds
  waitFor(Serial.isConnected, 30000);"localIP=%s", WiFi.localIP().toString().c_str());"subnetMask=%s", WiFi.subnetMask().toString().c_str());"gatewayIP=%s", WiFi.gatewayIP().toString().c_str());"SSID=%s", WiFi.SSID().toString().c_str());

void loop()
  if (client.connected()) {
    // echo all available bytes back to the client
    while (client.available()) {
  } else {
    // if no client is yet connected, check for a new connection
    client = server.available();