Robert Murrell
|
How to tell if ethernet cable is unplugged?
|
Robert Murrell
04/03/2013 3:50 PM
post100294
|
How to tell if ethernet cable is unplugged?
How do I programmatically detect if the Ethernet cable has been unplugged? I tried the ioctl SIOCGIFFLAGS command to
look at the IFF_UP and IFF_RUNNING flags, but these are always set. ifconfig seems to know because when the cable is
plugged in, it displays:
status: active
Since the source code is nearly impossible to access, I can't see how it knows. Does anyone know the magic function to
determine this?
|
|
|