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

RE: Detecting Ethernet link and setting TCP timeout




> -----Original Message-----
> From: owner-dev-etrax@xxxxxxx.com 
> [mailto:owner-dev-etrax@xxxxxxx.com] On Behalf Of Phillip Moore
> Sent: den 25 juni 2004 15:24
> To: dev-etrax
> Subject: Detecting Ethernet link and setting TCP timeout
> 
> 
> I am having problems detecting when the Ethernet goes away 
> (unplugged or
> broken line)

In general this is not a good idea. TCP is intentionally designed
so that connections should survive temporary network problems.

If your application need this you are better of handling it at the
application level.

> Does anyone know how or if I can detect if the Ethernet is 
> not there and how

You would either have to poll the status from user space or add
some mechanism that allows the driver to pass information about 
status changes to user space.

> to set the TCP timeout?

You cannot.
 
> I tried this to set the timeout and it does not fail but it 
> does not change
> the timeout on sends, it still takes 15 minutes before I get 
> a timeout on
> the send.

For TCP the SO_SNDTIMEO socket option will affect how long a system
call to send data may block (waiting for buffer space to become
available etc.). It does not affect the TCP transmission timeout.

> I see it call mdio function to get the Ethernet speed but 
> when I try it in
> my application I get a segfault, probably because I am not 
> supposed to be
> doing this this way, or I missed something.  Does anyone know 
> how to get
> this information?

You should be able to use the SIOCETHTOOL ioctl to get this information
from user space.

--
Lars Viklund
Expert Software Engineer
Software Platforms
Axis Communications AB