[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] LWIP raw TCP socket disconnection
From: |
Sergio R. Caprile |
Subject: |
Re: [lwip-users] LWIP raw TCP socket disconnection |
Date: |
Wed, 10 Feb 2016 11:20:51 -0300 |
User-agent: |
Mozilla/5.0 (Windows NT 5.1; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 |
It is not common to have the cable unplugged, but if you must detect
that, you need an ethernet driver (and chip/controller) with link status
indication. That is transparent to lwIP, you handle that directly with
your chip/controller; although the driver might have the capability to
signal lwIP and you could see that on lwIP's netif status, but... check
for LWIP_NETIF_LINK_CALLBACK in your options file and you can use
netif_set_link_callback() to set your callback if your driver calls
netif_set_link_down()/netif_set_link_up(). Mine doesn't...
Besides that, if your application needs to be "connection status aware",
you need to implement a connection status detection mechanism yourself,
that is not built into TCP for short term transmissions or receive only
application states. Keepalives and transmission timeouts will eventually
signal a connection loss, and you can always set short timers, but if
you need a proper handling you need to build it into your application.
Make sure you read Joel's doc _before_ you try to do that... ;^)