Some suggestions:
1) Use 2 connections (ports) – one for the real connection and one for the 15S ping.
2) Use TCP_KEEPALIVEs, but you have to change the default TCP_KEEPALIVE time on the other end since the default is a long time and it won’t notice the lost connection.
3) Use UDP and send a “ping” for checking the device.
I use the latter using a 5S sending period with a UDP broadcast and it works pretty well for the PC (Win32) app to see the lwIP devices come and go. This ping also gives me the opportunity to send out the device’s IP address in the payload so that the PC can make a connection (TCP) once it sees the device.
Bill
What you are doing is already the best solution, I guess: design the
communication protocol in a way that always at least a little data is
being sent so that the other end can detect when that data doesn't come.
Regarding the connection closure, that depends on the protocol being
used: raw API returns a null pbuf, the other APIs have other means to
tell you the remote side closed - but all this happens only after large
timeouts when using the default TCP parameters.
Simon
> ------------------------------------------------------------------------
>
> _______________________________________________
> lwip-users mailing list
> lwip-...@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/lwip-users
_______________________________________________
lwip-users mailing list
lwip-...@nongnu.org
http://lists.nongnu.org/mailman/listinfo/lwip-users