lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] netconn_recv blocking forever


From: Kieran Mansley
Subject: Re: [lwip-users] netconn_recv blocking forever
Date: Thu, 08 Mar 2007 13:39:40 +0000

On Thu, 2007-03-08 at 14:27 +0100, Mateusz Plocinski wrote:
> Hi,
> I'm using an ARM7 FreeRTOS port of lwip. I'm trying to implement a
> thread which waits for data from PC using netconn_recv. Everything
> works fine in most situations (for week or longer without any
> problems), but when I disconnect network cable or PC simply hangs up
> without closing a connection, my lwip socket thread still sits in
> netconn_recv function.
> 
> Is there any way to check if connection isnt dead while thread is
> blocked in netconn_recv? I need to know in few seconds if I should
> close connection because I need to quickly restart connection to my
> ARM hardware (and I have only on thread so I cant open more sockets to
> wait for connection).

I think the short answer to this is "No".  There are all sorts of
network faults (e.g. unplugged cables, or server dieing without closing
connections, etc) that aren't detectable by one end of the connection.

You could try using the TCP KEEPALIVE support, but that takes a minimum
of two hours to report a connection as broken, rather than a few
seconds, because TCP is designed to survive short outages of a few
seconds.

You could modify your application and server so that they (for example
once every 10 seconds) send each other a "are you still there" message,
and reply "yes I'm still here".  Then, if you don't receive the reply
you can guess that something has gone wrong.  

Kieran





reply via email to

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