Hi all.
First, let me say this is not a Particle problem. I have had similar code working fine in my home Wifi. Unfortunately I am not home but in a nursing facility so I am having to deal with their wifi.
The photon runs fine and gets as far as creating a client from the server.My clients include my laptop, an android tablet and a phone. (downloaded TCP packet sender apps). I have never completed the connection.
Traceroute and ping don’t work unless I ping the public IP. but I cant get either to work between local IP devices. So finally, my question is, what about the wifi setup would prevent communications between local devices? I have attached my code just in case I did screw something up.
Thanks for the help.
TCPServer server = TCPServer(2607);
TCPClient client;
void setup()
{
// start listening for clients
server.begin();
RGB.control(true);
RGB.color(255,255,255);
Serial.begin(9600);
waitFor(Serial.isConnected, 30000);
Serial.println(WiFi.localIP());
Serial.println(WiFi.subnetMask());
Serial.println(WiFi.gatewayIP());
Serial.println(WiFi.SSID());
IPAddress host= WiFi.localIP();
uint16_t np= WiFi.ping(IPAddress(65, 60, 111, 83));
Serial.printf(" Ping returned %d\n", np);
}
void loop()
{
uint16_t count1= client.available();
Serial.printf("this client better?? - 0x%08x - bytes queued: %d - connected? %d\n", client, count1, client.connected());
RGB.color(0,0,255);
delay(1000);
if (client && client.connected())
{
RGB.color(0,255,0);
delay(1000);
// echo all available bytes back to the client
while (client.available())
{
Serial.printf("in collection loop\n");
// server.write(client.read());
}
}
else
{
// if no client is yet connected, check for a new connection
client = server.available();
RGB.color(255,0,0);
delay(1000);
}
}