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

Detecting Ethernet link and setting TCP timeout

I am having problems detecting when the Ethernet goes away (unplugged or
broken line)
Sent packets wait in the TCP buffer and take 15 minutes to timeout.

Does anyone know how or if I can detect if the Ethernet is not there and how
to set the TCP timeout?

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.

bzero(&tv, sizeof(tv));
tv.tv_sec = 120;
tv.tv_usec = 0;
if (setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (const void*) &tv, sizeof(tv))
== -1)

Also on the Ethernet link I looked at the driver and it has this function
	static void e100_check_speed(unsigned long dummy)

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?