Boost logo

Boost :

Subject: [boost] Asio AcceptEx failing with error 121 on Windows with multiple network connections
From: Stuart A. Malone (samalone_at_[hidden])
Date: 2008-12-23 11:20:08

Hi folks,

I'm working with the Boost Asio library from Boost 1.37 on Mac and
Windows, and have encountered a problem that only occurs on Windows,
and only when the computer has multiple network connections (such as
both wired ethernet and WiFi).

I started with the "HTTP Server" example code for a simple single-
threaded server. I'm running the server on address with port
number 0 so that it listens on all network interfaces and allows the
OS to select the port number.

The server works fine on a Mac with multiple network connections. And
on Windows, the default (wired ethernet) connection works fine, too.
But if I try to connect to the Windows server over the non-default
(WiFi) connection, there is about a 20 second pause and the server
exits with error 121, "The semaphore timeout period has expired."

I've done some poking around under the debugger, and it appears that
the origin of this error is the AcceptEx call in the async_accept<>
function in win_iocp_socket_service.hpp, line 2129. While this call
does not fail directly since it is an asynchronous call, the error
code eventually turns up in the accept_operation::do_completion_impl
function in win_iocp_socket_service.hpp, line 1908.

I don't really know enough about either Boost Asio or Windows
networking to figure out much more on my own. Does anyone have an
insight into the source of this problem, or suggestions on how I might
go about tracking it down further?

Best wishes,

--Stuart A. Malone
   Llamagraphics, Inc.
   Makers of Life Balance personal coaching software

Boost list run by bdawes at, gregod at, cpdaniel at, john at