Blocking code for Windows Pipes.
George S. Lockwood
gslockwood at gmail.com
Wed Aug 23 10:15:24 EDT 2006
Hello, I have implemented the new s/w code for the windows named pipe
resource and it works fine for using the single wpa_ctrl (and
attached) to send msgs.
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.
Have you already tested this out? Perhaps I need to adjust my code in some way?
What exactly should I block for?
Here's my the code my thread starts as is today (I pass a pointer to
my object so I can access the wpa_ctrl member):
LPTHREAD_START_ROUTINE receiveMsgs( LPVOID lpParam )
CPPCWPA* pThis = NULL;
pThis = (CPPCWPA*)lpParam;
while( TRUE )
cout << "inside true" << endl;
DWORD dwResult = WaitForSingleObject( (HANDLE)wpa_ctrl_get_fd(
pThis->m_pWpa_ctrlMonitor ), INFINITE );//m_pWpa_ctrlMonitor
DWORD dwError = GetLastError();
if (dwResult == WAIT_OBJECT_0)
// don't need wpa_ctrl_pending with the WaitForSingleObject
//while( wpa_ctrl_pending( pThis->m_pWpa_ctrlMonitor ) ) //monitor_conn
len = sizeof(buf) - 1;
if (wpa_ctrl_recv( pThis->m_pWpa_ctrlMonitor, buf, &len) == 0)
buf[len] = '\0';
pThis->EventMessageHandler( buf, len );
}// end while
More information about the HostAP