lua-users home
lua-l archive

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


* Diego Nehab:

> I think that what I do is call connect. It will return
> "timeout" if connection is in progress.  The socket will select
> writeable once the result of connect arrives. Then you call
> connect again and it will either work immediately or it will
> report an error with "alraedy connected". If it says
> "timeout" again, you know it really timedout.

The standard way is to look at SO_ERROR with getsockopt (but that API
is not very standard--some systems return the error code in errno,
others return it in the passed integer).

I don't know if there are any systems which return misleading error
codes on a second connect, but I suspect that there are.