# TCPServer/TCPClient issues \[SOLVED\]

**URL:** <https://community.particle.io/t/tcpserver-tcpclient-issues-solved/13036>\
**Category:** Firmware\
**Created:** [July 7, 2015, 2:16am UTC](https://community.particle.io/t/tcpserver-tcpclient-issues-solved/13036 "2015-07-07T02:16:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![spacemanspiff](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@spacemanspiff](https://community.particle.io/u/spacemanspiff)\
**Post date:** [July 7, 2015, 2:16am UTC](https://community.particle.io/t/tcpserver-tcpclient-issues-solved/13036/1 "2015-07-07T02:16:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![AndyW](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/andyw/32/686_2.png) [@AndyW](https://community.particle.io/u/AndyW)\
**Post date:** [July 7, 2015, 5:09am UTC](https://community.particle.io/t/tcpserver-tcpclient-issues-solved/13036/2 "2015-07-07T05:09:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![AndyW](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/andyw/32/686_2.png) [@AndyW](https://community.particle.io/u/AndyW)\
**Post date:** [July 7, 2015, 5:24am UTC](https://community.particle.io/t/tcpserver-tcpclient-issues-solved/13036/3 "2015-07-07T05:24:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![spacemanspiff](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@spacemanspiff](https://community.particle.io/u/spacemanspiff)\
**Post date:** [July 7, 2015, 3:09pm UTC](https://community.particle.io/t/tcpserver-tcpclient-issues-solved/13036/4 "2015-07-07T15:09:18Z")

</div>

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 😄

Regards,

Mark
