TCPServer/TCPClient issues [SOLVED]

This may be a more general Telnet question, I’m not sure.

I’d like to send a string of ASCII to my Core over TCP/Telnet. I’m using the code in the firmware documentation:

// EXAMPLE USAGE

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

void setup()
{
  // start listening for clients
  server.begin();

  // Make sure your Serial Terminal app is closed before powering your device
  Serial.begin(9600);
  // Now open your Serial Terminal, and hit any key to continue!
  while(!Serial.available()) SPARK_WLAN_Loop();

  Serial.println(WiFi.localIP());
  Serial.println(WiFi.subnetMask());
  Serial.println(WiFi.gatewayIP());
  Serial.println(WiFi.SSID());
}

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

I’m able to connect to the core just fine using its local IP address, however, I have been unable to connect over the internet (using the IP address listed in the dashboard).

I’m using Tera Terminal and other than the IP address, I haven’t changed anything when I attempt to connect.

Any ideas?

Thanks very much in advance,

Mark

I assume you are behind a firewall that is doing outbound NAT.

Have you setup an incoming rule to accept telnet connections from outside the firewall and map that to your core ?

Without that, the firewall is doing what you bought it to do.

3 Likes

And to be clear - opening a telnet port up to the internet is probably a pretty poor idea. It’s not like anyone is going to crack your core, but they can probably crash it as a side effect of running port scanners & scripts against it.

2 Likes

Andy,

You were right on both counts. Connected fine on port 80. And, this isn’t the way I want to solve my problem, overall.

Thanks for getting my Telnet to work an hour before I abandoned it :smile:

Regards,

Mark

1 Like