lua-users home
lua-l archive

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


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?
No idea.

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
	if(flag==NIL) then
		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
	end