more specific TCP bindings

Marc Slemko (marcs@znep.com)
Sun, 18 Oct 1998 16:57:20 -0700 (PDT)


marcs@lerkim:~$ nc -v -l -p 8888 &
[1] 6475
marcs@lerkim:~$ listening on [any] 8888 ...
nc -v -l -p 8888 -s localhost
retrying local 127.0.0.1:8888 : Address already in use

marcs@lerkim:~$ nc -u -v -l -p 8888 &
[1] 6477
marcs@lerkim:~$ listening on [any] 8888 ...
nc -u -v -l -p 8888 -s localhost
listening on [127.0.0.1] 8888 ...

If I bind a TCP socket to INADDR_ANY with SO_REUSEADDR set, then try to
bind to a specific address, it is denied. Trying to do the same thing
works with UDP.

Aside from the fact that being able to do this is a useful feature, it is
inconsistent between UDP and TCP.

If this is supposed to be some solution to stealing ports by more specific
bindings, then it certainly seems to be the wrong solution.

What is the reasoning behind this incompatibility?

Tested on 2.1.107, 2.0.35 and 2.1.125.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/