lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Recovering from network outage


From: Thompson, Jeff
Subject: Re: [lwip-users] Recovering from network outage
Date: Tue, 13 Apr 2021 11:31:45 +0000

Regarding the connection timeout, I tried setting timeout values for the socket 
immediately after creating it:

        struct timeval sendToVal =
        {
                .tv_sec = HTTPS_SOCKET_TIMEOUT,
                .tv_usec = 0
        };

        lwip_setsockopt(*(int *)sockFd, SOL_SOCKET, SO_SNDTIMEO, &sendToVal, 
sizeof(sendToVal) );
        lwip_setsockopt(*(int *)sockFd, SOL_SOCKET, SO_RCVTIMEO, &sendToVal, 
sizeof(sendToVal) );

but the call to lwIP_recv does not return after I pull the cable on the network 
side of my switch and wait for much longer than the timeout value I set.

Jeff Thompson  |  Senior Electrical Engineer-Firmware
+1 704 752 6513 x1394
www.invue.com
-----Original Message-----
From: lwip-users <lwip-users-bounces+jeffthompson=invue.com@nongnu.org> On 
Behalf Of goldsimon@gmx.de
Sent: Tuesday, April 13, 2021 05:17
To: Mailing list for lwIP users <lwip-users@nongnu.org>
Subject: Re: [lwip-users] Recovering from network outage

Am 13.04.2021 um 08:08 schrieb Rod Boyce:
> Jeff,
>
> It sounds like you are using Ethernet this being the case you can 
> detect link-up and link-down from the Ethernet PHY.
>
> This means that you can poll the Ethernet PHY for link status and 
> either take networking down when Phy is disconnected or bring 
> networking up when Phy is connected.

While you can check if the phy is reconnected (hint: use the link status 
callback provided by lwIP), this will not be of much use, as you could well get 
disconnected behind the first (or any) switch (so your own link status always 
stays up).

In this case, there's really no other option than to poll for a connection and 
wait for it to succceed. Ideally, you'd combine this with a low-enough (but not 
too low) connection timeout.

Regards,
Simon

>
>
> Hope that helps.
>
> Rod
>
>
> On 12/04/2021 21:03, Thompson, Jeff wrote:
>>
>> How can I recover from a network outage? I leave the cable from my 
>> system to the network switch connected, but pull the cable from the 
>> network switch to the cloud. Detecting that the server I was talking 
>> to is no longer talking is easy enough, but how do I recover? I’m 
>> using a plain old socket to make the connection, and
>> lwIP_send/lwIP_recv) for data transfer of an HTTPS GET request.
>>
>>  
>>
>> I start up a timer that expires if there is no server response after 
>> a minute; much more than enough, I’m told. But what then? Can the 
>> timer callback do anything to make lwIP_send or lwIP_recv return to 
>> the calling task, preferably with an error?
>>
>>  
>>
>> *Jeff Thompson* |  Senior Electrical Engineer-Firmware
>> +1 704 752 6513 x1394
>> www.invue.com <www.invue.com>
>>
>>  
>>
>>
>> _______________________________________________
>> lwip-users mailing list
>> lwip-users@nongnu.org
>> https://lists.nongnu.org/mailman/listinfo/lwip-users
>
> _______________________________________________
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>


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

reply via email to

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