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

 

From: [email protected]
[mailto:[email protected]] On Behalf
Of Gurpal Gill
Sent: Monday, March 30, 2009 1:08 PM
To: [email protected]
Subject: [lwip-users] TCP Disconnect Detection lwIP V1.2

 

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

Reply via email to