lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

> I use Lua on a 5 year old 400MHz laptop running Windows 98 and I'm not
> planning to upgrade!  :-)

It's even worse: ConnectEx was introduced later than AcceptEx and
is not available on Win2K, too. And some integrated firewalls on WinXP
fail to support this call, too ...

> So AcceptEx and completion ports are not an
> option.  Is it not possible to bind multiple sockets to a single event using
> WSAEventSelect?

It is possible. But then you need to loop through all sockets and check
their status with WSAEnumNetworkEvents. Apart from the inefficiency there
is a hidden race condition: WSAEnumNetworkEvents resets the associated
event handle, so you may loose an FD_CONNECT notification that happens
after the wait but before checking the status of all sockets. This won't
work reliably.

The solutions I found when searching for this topic range from creating
one thread per 64 handles to using WSAAsyncSelect plus a message loop.
In Win2K there is even RegisterWaitForSingleObject to automate the
first solution. These solutions may work well in a custom application
where you write all network code on your own, but they are not easily
encapsulated into a generic socket/event library.

BTW: It's funny when you start finding your own posts in the search engines
     when looking for information on this topic ...

I suggest to use WSAConnect + WSAEventSelect in the first release. This
will limit us to a maximum of 63 parallel async connections. We may add
conditional support for WSAConnectEx in a later release. Due to the way
the event API works, this change is completely transparent (you get an
event id, no matter which event type is used internally).

I'm sorry, but you won't be able to run a high-volume mailing list server
on your laptop with Win98. ;-)

Bye,
     Mike