1

I borrowed from this gentleman in order to request the signal strength of a wireless connection on my device. I would also like to use ioctl to get the operstate and whether or not there's up/down stream information flowing over the connection.

Basically, I'm attempting to modernize the look of this device, adding to it real-time status icons of link operability, quality, and activity. Originally, I was using popen() to cat and parse /proc/net/wireless and /sys/class/net/wlan0/operstate. The only issue was that occasionally that would fail (I assume because the OS had locked the file) so it was causing crashes.

So, my questions are two:

One, can I use ioctl in a way similar to the one described in the link above to monitor the operstate and connection activity? The information I could find pertaining to this was only for ifreq, not iwreq.

Two, it occurred to me while writing this that I should probably just have the kernel telling my application when the status of the wireless device changes, shouldn't I? I can't imagine various desktops' system trays have polling loops in them.

Actual Two: is there a way to have the kernel feed information into my application about operstate, link quality, and link activity in real-time?

Thank you in advance. =)

pdm
  • 1,027
  • 1
  • 9
  • 24
  • You can use select() on a socket to be notified of state changes. Here is a question/answer which describes a similar situation: http://stackoverflow.com/questions/5640144/c-how-to-use-select-to-see-if-a-socket-has-closed – Peter L. Aug 07 '13 at 23:25
  • Also look into using wpa_supplicant software to manage your wireless connection. It has an internal state machine for all kinds of wireless events. – Peter L. Aug 07 '13 at 23:27

0 Answers0