Corinna Vinschen wrote:
On Jan 13 00:36, Mark Geisert wrote:
This report is based on a series of recent list emails with Subject: lines
"RPC clnt_create() adress already in use" which date back to last September
but are unfortunately not chained together... They contain a discussion
I've been having with OP Raimund Paulus.
I believe I've distilled the issue(s) down as far as I can. A
self-contained STC is included at the end of this email.
On the latest 64-bit Cygwin, running the STC shows:
~ netstat -an|grep :111
TCP 0.0.0.0:111 0.0.0.0:0 LISTENING
TCP [::]:111 [::]:0 LISTENING
UDP 0.0.0.0:111 *:*
UDP [::]:111 *:*
~ ./bindtest
1st socket is 3
1st bind OK
1st connect OK
2nd socket is 3
2nd bind OK
2nd connect: Address already in use
~ ./bindtest
1st socket is 3
1st bind OK
1st connect: Address already in use
On Fedora 27, running the same STC shows:
[mark@lux ~]$ netstat -an|grep :111
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp6 0 0 :::111 :::* LISTEN
udp 0 0 0.0.0.0:111 0.0.0.0:*
udp6 0 0 :::111 :::*
[mark@lux ~]$ ./bindtest
1st socket is 3
1st bind OK
1st connect OK
2nd socket is 3
2nd bind OK
2nd connect OK
I can't reproduce this:
$ uname -sr
Linux 4.14.13-300.fc27.x86_64
$ netstat -an|grep :111
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp6 0 0 :::111 :::* LISTEN
udp 0 0 0.0.0.0:111 0.0.0.0:*
udp6 0 0 :::111 :::*
$ ./bindtest
1st socket is 3
1st bind OK
1st connect OK
2nd socket is 3
2nd bind OK
2nd connect: Cannot assign requested address
I tried this a couple of times even as root, just to be sure, but the
result is invariable "2nd connect: Cannot assign requested address".
The error message is different from Cygwin, but the overall behaviour is
the same for me, and it matches the comment I wrote in cygwin_setsockopt
back in 2009 and 2011.
I'm very puzzled that it works for you. As I wrote in my comment, a
complete duplicate of a local TCP address is not allowed, regardless of
SO_REUSEADDR.
If I may quote Mr. Network himself, the late W. R. Stevens, "UNIX
Network Programming, Networking APIs: Sockets and XTI", Volume 1, 2nd
Edition. Section 7.5:
"With TCP we are never able to start multiple servers that bind the
same IP address and the same port: a 'complete duplicate binding'.
That is, we cannot start one server that binds 198.69.10.2 port 80
and start another that also binds 198.69.10.2 port 80, even if we set
the SO_REUSEADDR soocket option for the second server."
Rats. I'll have to investigate a couple of directions, deeper. It makes sense
that connect() returns EADDRINUSE rather than bind() because only connect()
knows about all 5 parts of the 5-tuple. Stevens is/was the definitive network
software guy. Miss him. Most accounts I've found deal with SO_REUSEADDR on the
server side, not the client side, so my intuition is a bit faulty.
Thanks for your time, Corinna. Raimund: I'll have to do some more digging when
I get back to a keyboard in a week or so. Sorry for the delay on this. There
might be some issue inside libtirpc where it botches error returns from the
kernel. Or something.
Thanks all,
..mark
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple