Re: Detecting ethernet cable plugged in
Re: Detecting ethernet cable plugged in
- Subject: Re: Detecting ethernet cable plugged in
- From: Josh Graessley <email@hidden>
- Date: Tue, 02 Oct 2007 08:31:43 -0700
I think you can use ioctls to get the interface media information.
Look at the output from ifconfig. There is a media entry:
media: autoselect (1000baseT <full-duplex,flow-control>) status: active
If you see status: active, the link is up. You can look through the
ifconfig sources to see how ifconfig gets this information.
System Configuration will publish the link state regardless of IP
settings. There is a system configuration agent that monitors kernel
events and publishes state about things like the link status of
interfaces to the dynamic store.
You may see no active link status if there are no services using the
interface. In this case, the interface may be powered down to save
power. When the interface is powered down, the link is down whether or
not the cable is connected.
-josh
On Oct 2, 2007, at 2:29 AM, Mark Thomas wrote:
Hi All,
I presently using the System Configuration Dynamic store Ethernet
device
link status, to detect if users have plugged in the Ethernet cables
and
while this works, there is a slight problem as this status is linked
to the
tcp/ip stack being setup correctly.
Does anybody know of another way to detect whether that cable is
plugged
in ?, which wouldn't have a dependency on the network stack ?
Thanks
Mark.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden