Arm Mbed OS support forum

TCP Server connecting to adafruit ESP32

I’m trying to set up a TCP Server on my STM STM B-L475E-IOT01A that can be connected to by an application on a computer and by another micro controller using TCP sockets
I’m trying to use the TCPServer.h Library from the Mbed-os Library as well as the TCPSocket.h library, the problem is I cant find any sample code that uses these specifically, so I feel like I’m flying dark.
This is what I have once i’ve established a connection to my LAN,
TCPServer sensorServer;
TCPServer appServer;
nsapi_error_t response;
printf(“Waiting for connection from client\n”);

sensorServer.open(net);
sensorServer.set_blocking(false);
sensorServer.bind(80);
while(1)
{
    response = sensorServer.listen();
    if(response == 0)
    {
        printf("Server established\n");
    }

}

so far any attempts i make to connect to this server has failed so i dont know how to proceed, since I dont know what i’m doing wrong. I dont get any errors I just cannot connect whether from putty or from the other devices i want to use.
Any help would be GREATLY appreciated.

Hello,

it seems you use some old version of MbedOS (older than 5.12), the TCPServer.h is obsolete and all necessary things (Server/client) are under under the TCPSocket in the MbedOS 5.12 - MbedOS 6.8 (latest).

Anyway you need to read Mbed documentation about Socket

So in your loop you only again and again set the number of connections.

The old TCPServer was something like is here
About current TCP Server you can read in topics below.

BR, Jan