HI all, I’m having issues using the TCPServer to accept connections on my core.
I have seen others having issues but everyone else seems to be able to at least accept the socket connection.
My program initially had other stuff going on, but I removed all but the TCPServer stuff. Here is my code:
/* Includes ------------------------------------------------------------------*/
#include "application.h"
USBSerial *pc = new USBSerial();
TCPServer srv(1966);
SYSTEM_MODE(AUTOMATIC);
/* This function is called once at start up ----------------------------------*/
void setup()
{
pc->begin(115200);
delay(10000);
pc->print("Press a key\r\n");
while(!pc->available());
pc->read();
WiFi.connect();
if(WiFi.ready())
{
pc->println("WiFi is ready");
}
String resp;
resp += "My IP =";
IPAddress myIp = WiFi.localIP();
resp += myIp[0];
resp += '.';
resp += myIp[1];
resp += '.';
resp += myIp[2];
resp += '.';
resp += myIp[3];
pc->println(resp);
srv.begin();
}
/* This function loops forever --------------------------------------------*/
void loop()
{
TCPClient cli = srv.available();
if(cli.connected())
{
pc->println("Got a client request");
// Look at the packet ant send the proper response
if(cli.available())
{
String request = cli.readString();
pc->println(request);
}
}
}
I’ve watched on WireShark and I see my test program on the PC sending the TCP SYN to start the connection but the core never replies.
Thanks in advance for any and all help!