* bind()/connect() to port 0 question for tcp/udp
@ 2002-07-30 13:31 Geoffrey Lee
0 siblings, 0 replies; only message in thread
From: Geoffrey Lee @ 2002-07-30 13:31 UTC (permalink / raw)
To: linux-kernel
Hi list,
I want to ask a question:
In sockets, what is the correct behavior when we try to connect() to port 0
for tcp / udp?
It seems that FreeBSD returns EADDRNOTAVAIL, as does Solaris.
So something like this will fail on Solaris and FreeBSD:
[...]
saddr.sin_port = htons(0);
[...]
connect(AF_INET, (struct sockaddr *)&saddr, sizeof(struct sockaddr));
We don't do this however, and Linux will merrily accept a port of 0 in
a connect(), though most probably your connect() wouldn't succeed.
Making it return EADDRNOTAVAIL to user space would be a trivial task, so
I want to ask, is this a buglet in the Linux implementation, or is FreeBSD
and Solaris wrong?
- G.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-07-30 13:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-30 13:31 bind()/connect() to port 0 question for tcp/udp Geoffrey Lee
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®