TCPServer and Client on 2 ports

i have an APP which uses TCPClient and TCPServer but i need to constantly update some temperatures an still be able to fire up some functions but when i use it on one port i keep getting temps back in functions and reverse
could anybody please give me an example how i could do that
Thanks

Let me ping someone that might be able to help, @rickkas7 or @ParticleD are you able to assist?

There’s not really enough information to go on. However, since the TCP server and client are independent of each other, you really don’t need an example with both. Search the forum for a server example and implement that part. The client part is really simple after you get the server part working.

2 Likes

This is my code so far is this right?

TCPServer server2020 = TCPServer(2020);
TCPServer server3030 = TCPServer(3030);
TCPClient client2020;
TCPClient client3030;

void setup()
{
  server2020.begin();
  server3030.begin();
}

void loop()
{
  if (client2020.connected()) 
  {
    while (client2020.available()) 
    {
        String incomming = client2020.readStringUntil('\n');
      	server2020.write("Server2020" + incomming);
      	client2020.write("Client2020" + incomming);
    }
  }
  else 
  {
    client2020 = server2020.available();
  }
  if (client3030.connected()) 
  {
    while (client3030.available()) 
    {
        String incomming = client3030.readStringUntil('\n');
      	server3030.write("Server3030" + incomming);
      	client3030.write("Client3030" + incomming);
    }
  }
  else 
  {
    client3030 = server3030.available();
  }
}