lua-users home
lua-l archive

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


On Fri, Mar 19, 2010 at 4:22 PM, Ted Unangst <ted.unangst@gmail.com> wrote:
> On Wed, Feb 24, 2010 at 6:34 PM, Sam Roberts <vieuxtech@gmail.com> wrote:
>> This is purely a luasocket behaviour. The system calls allow bind() to
>> fail, leaving the socket valid.
>
> Only on some systems.

a) If such a system exists, wouldn't this be considered an unfortunate
bug in that system?

>> This behaviour of luasocket is particularly anti-social when
>> attempting to repeatedly bind to local ports, to search for one that
>> is free.
>
> You're supposed to create a new socket after a failed bind.  Read your
> Stevens. :)

b) Do you have a page or section reference?

I find no mention of this in "Unix Network Progamming - Networking
APIs: Sockets and XTI", 2ed, under the bind or udp docs, but its a big
book. I have copies of TCP/IP illustrated, too, if you find this claim
in them.

Also, those books are old. In none of  these do I see a claim that
returning an error invalidates the descriptor:

http://developer.apple.com/Mac/library/documentation/Darwin/Reference/ManPages/man2/bind.2.html

http://www.freebsd.org/cgi/man.cgi?query=bind&apropos=0&sektion=2&manpath=FreeBSD+8.0-RELEASE&format=html

http://docs.sun.com/app/docs/doc/816-5170/bind-3socket?a=view

I do see "A process with a connnected UDP socket can call connect
again for that socket." (p.226, also the freebsd man pages). This
isn't supported by luasocket, either, connected sockets can only be
disconnected:

http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/udp.html#setpeername

Cheers,
Sam