Questions like this one are often asked here. In fact, TCP is not really
helpful here. There are a few parameters to tweak to make TCP detect
connection errors earlier, but most of them have some side-effects so
that you really have to know what you are doing.
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
Gurpal Gill wrote:
Hello,
I'm wondering how to detect that a TCP connection has been closed?
Also, if a connection were to get disconnected via a power outage
(simulated by disconnecting the ethernet cable from the device)?
Currently I transmit a byte of data every 15secs of no activity and
when I get an error I close the connection. I need a better way since
the application on the other end has to process the byte that I'm
sending which causes problems. I'm using lwIP with the xilinx tools
(S3ADSP1800A eval board). Just a note, I'm using lwIP in non blocking
mode so the read command either returns -1 or the number of bytes
read. Any help would be appreciated.
Regards,
Gurpal Gill
------------------------------------------------------------------------
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users