Blocking code for Windows Pipes.

Jouni Malinen jkmaline
Sat Aug 26 15:04:03 PDT 2006

On Wed, Aug 23, 2006 at 07:15:24AM -0700, George S. Lockwood wrote:

> However, when I implemented a second wpa_ctrl (and attached to it
> instead of the first) to monitor the unsolicited msg and using the
> same code I set up to create a thread and block for the msgs for when
> the s/w code was using udp sockets, it seems to block that thread and
> never receive a msg to process.

> 		DWORD dwResult = WaitForSingleObject( (HANDLE)wpa_ctrl_get_fd(
> pThis->m_pWpa_ctrlMonitor ), INFINITE );//m_pWpa_ctrlMonitor

This won't work with Windows named pipes -based control interface.
wpa_ctrl_get_fd() is just returning -1 to indicate an error. If you
want to use WaitForSingleObject to wait for events, you would at least
need to change wpa_ctrl_get_fd() to return the file handle. Though, I'm
not sure whether that would work without issues with named pipes.
Another option is to use overlapped read/write in the same way as
wpa_supplicant is doing in ctrl_iface_named_pipe.c.

Jouni Malinen                                            PGP id EFC895FA

More information about the Hostap mailing list