[En-Nut-Discussion] Network Link state on at91_emac and others

Alain M. alainm at pobox.com
Mon Sep 15 21:43:32 CEST 2008


Thiago A. Corrêa escreveu:
> 
> Well, I agree to some extent. Perhaps a cable disconnect should
> trigger the timeout counter and droping the sockets when it reaches
> zero is the safest thing to do. On the other hand if cable is
> reinserted before that, then do nothing.
> 
> Consider that on a connection, the PC sends data soon after the cable
> is disconnected on the nut box. The PC will eventually timeout and
> drop the connection, and when the cable is reinserted to the nut box,
> it will not see any of the transmission attempts form the PC and might
> be stuck in the NutTcpReceive beliving the connection is still open.
> In this state the PC box can't even reestablish the connection if the
> nut application isn't threaded in a maner similar to the HTTP example.
> If done multiple times, the socket descriptors will also run out even
> on the HTTP example and we will end up with an unresponsive nut box
> until NutTcpReceive times out, if it has any timeout.

FWIK, there is no interface to warn of a disconnected network, but an 
error if an attempt is bade to connect/send.

In fact, one of the problems of problems of creating a TCP device is all 
this reconnect stuff :)

> Does Nut threads die gracefully now days? Having one for
> initialization might be a problem if that's not the case.

This thread should no die, it should keep monitoring for an eventual 
disconnect and eventual-reconnect.

> AFAIK recv's and send's fails instantaneously under windows when cable
> is disconnected, but bind's will still work across cable
> connect/disconnect cycles. At least that's what I remember from my UO
> server development days :D

I just checked with a friend, and he confirmed that it happens. He does 
not remember what happens after the cable is reconnected, but it 
eventualy reconects all by itself.

> Of course, it only applies to the interface in question, the other
> interfaces where nothing happened remain the same.

Of course, the way that I see it, a thread could exist for each device 
or only one that takes care of all devices.

Alain




More information about the En-Nut-Discussion mailing list