Have searched and been unable to find my problem in the forums here.
I have an app on a photon that is controlled by an windows c# app on a pc. all happy cases work great… connection stable for days and days, no data loss, all is good.
if I crash my pc app, the particle appears to maintain the connection forever.
I have added a heartbeat message so the photon can detect the hang up and reset the socket, but I haven’t figured out how to do that.
here is my nominal startup code:
msgServer= new TCPServer(ipPort); msgServer->begin(); msgClient = msgServer->available(); // ****
if (msgClient.available()>= 4) // ****
then I read 4 bytes (message header)… additional bytes read as specified in the header
now if the pc app shuts down normally, the connection is dropped and the code starts calling the server->available() until a new connection is established.
all that works great.
if I crash the pc app, client.connected() continues to return true.
I have tried several things in the heartbeat code, including starting with a new server, just redoing the server.begin(), calling client.stop. these all seem to make the particle hang up solid.
thanks for any ideas.