From: [EMAIL PROTECTED]
Subject: [gentoo-user] Re: OT: How to check for an existing ethernet link ?
Date: Sun, 01 Oct 2006 10:27:34 -0500

> Meino Christian Cramer <[EMAIL PROTECTED]> writes:
> 
> > Hi,
> >
> >  sorry for being off topic, but I think, folks of this list have the
> >  knowledge to answer my question and I have no idea who to ask else...
> >
> >  I need to check from within a C-program whether the computer, the
> >  program is running on (OS: Linux), is connected to the ethernet. The
> >  program is running under root privilege. Before doing anything else
> >  with eth0, I want to check the link-LED of the ethernet card...so to
> >  say.
> >
> >  I sthere any "legal" way to do such things under Linux?
> 
> A common way is to use the result of a single ping to known up host,
> in an if/else control block.
> 
> -- 
> gentoo-user@gentoo.org mailing list
> 

The problem is a little different here. In principle ping'ing is a
good way to test the availablity of a net-connection. No doubt!

But in my case I have to avoid *ANY* timeouts (wayting for an answer
or another timeout for example: the timeout of "gethostbyname()") if
possible. My program has to react AS FAST AS POSSIBLE on error
conditions. So if I can check the availability of a net-connection
without actually accessing the net and wait for an answer (or an error
condition) it would be the best solution. The fact that I am urged to
use UDP makes things even more difficult. I know that simply
attaching the computer to a switch/hub and removing the net-plug there
makes the link check worthless ... but I want to try every possibility
to find out, whether there is the chance to contact the "target"
(wrong word...sorry) without trying exactly that (or similiar),
haveing to wait for an answer (or error condition) and paying the
panalty of timeouts then.

If there is any net-programming hyper-guru out there who knows some
special tricks to achieve the shortest possible time of
reaction...here is someone who will thank her/him very much for any
help in advance ! :)

keep hacking!
mcc
 
-- 
gentoo-user@gentoo.org mailing list

Reply via email to