Subject: Re: A simple TCP/socket/port question
To: VaX#n8 <firstname.lastname@example.org>
From: Ken Hornstein <email@example.com>
Date: 07/03/1996 10:50:03
>When a server or inetd forks off an individual process (say, uucpd) to
>deal with a particular client, I vaguely recall reading somewhere that
>although listening for requests is done on a well-known port, when the
>process accepts on the socket, it gets a different, higher-numbered port
>to work on.
Not true; the socket you accept() on still has the same port number.
>If this is not the case, how does the kernel distinguish messages going to
>different uucpd's (or, if uucp is a bad example, ftpd command channels)
A socket is really a 4-tuple; local port, local IP address, remote port,
remote IP address. The file descriptor points to whatever tuple the
connection is associated with. So if you receive data bound for port 21
(or whatever), the remote address and port are used to demultiplex the