[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaSocket: asynchronous connect on Windows not behaving properly
- From: Tim Channon <tc@...>
- Date: Wed, 11 Nov 2009 02:28:21 +0000
Jerome Vuarand wrote:
> Hi list,
> I'm trying to write a copas-like module that handles both incoming and
> outgoing connections. Since the socket:connect operation can take some
> time, and I may have other sockets ready to do something, I'm setting
> the timeout to zero, I call connect, but then select is not working as
> expected on Windows.
Some time ago I found a problem with the higher level calls, fail to
return status. Seem to recall working this out from the sources. The
documents are silent on specifying what actually happens.
The workaround was use the low level calls. Related to your problem?
Desperately trying to remember the details, found this in a source and
the comments are all I know.
fred = socket.tcp() -- do not use "shorthand" method, is badly behaved
flag, errorstring=fred:bind(host, port) -- this kind of bind works properly
print(flag, errorstring) -- prints socket in use if err... already used
fred:close() -- clean up dead object so we can try another port
without leaving junk