lua-users home
lua-l archive

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


On Sat, Mar 20, 2010 at 9:09 AM, Ted Unangst <ted.unangst@gmail.com> wrote:
> Ah, sorry, no reference, other than the man pages (for connect, not bind, oops).
>
> For UDP, you're certainly right.  I was thinking of the stream behavior.
>
> "Generally, stream sockets may successfully connect() only once;"  I
> think this is often interpreted to mean "one successful connect" but
> the implementation is actually "only call connect() once,
> successfully".


> The problem exists in OpenBSD and FreeBSD.  Possibly Mac, I didn't
> test at the time.  Sorry for the hazy memory.

Sure, connect() on a TCP socket kicks the TCP protocol's state machine
into motion, and traffic is sent, multiple connects wouldn't make
sense.

But the problem we have is with UDP, not TCP, and no protocol
interactions occur for either bind() or connect() with UDP, it's just
a matter of internal bookkeeping in the stack.

And actually, I didn't try TCP, but multiple bind()s of an unconnected
TCP socket to a local port is allowed by the stack, too, I've no idea
if luasocket disallows it, it was in the context of UDP that we found
luasocket throwing EBADF errors.

Cheers,
Sam