lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Best way for determining if a TCP connection is dead?


From: Stephen Cowell
Subject: Re: [lwip-users] Best way for determining if a TCP connection is dead?
Date: Wed, 24 Jan 2018 10:57:53 -0600
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2

I had to access my PHY chip to get the status of the line... using 1.4.1 here on an Atmel SAME4E.

...
      gmac_enable_management(GMAC, true);
      gmac_phy_read(GMAC, BOARD_GMAC_PHY_ADDR, GMII_BMSR, &ul_stat1);// get status from PHY
      gmac_enable_management(GMAC, false);

      if ((ul_stat1 & GMII_LINK_STATUS) == 0)
      {
          // do something...
      }
...

I'm using no OS (RAW) and doing this in main loop time... giant PITA.  Also, it's possible for a bad phy_read() to return all 1's... in which case you won't see the disconnect... dealing with that one now.
__
Steve
.

Stephen Cowell
Project Manager/Engineer
Plasmability LLC
Office (512) 267-7087
Cell  (512) 632-8593
www.plasmability.com

On 1/24/2018 10:35 AM, Chris Seto wrote:
I have some code which works great, based on the echo client example.

I'm working on hardening it, and I'm wondering with how best to deal with a dead TCP connection as a result of the network link being down (ie, Ethernet cable disconnected).

The echo client contains conditions for a software termination of the socket (ie, server sends am empty frame), but I don't see anything dealing with a more blunt loss of the connection.

Any advice?

Thanks,
Chris


_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users




reply via email to

[Prev in Thread] Current Thread [Next in Thread]