Subject: Re: A simple TCP/socket/port question
To: VaX#n8 <email@example.com>
From: Curt Sampson <firstname.lastname@example.org>
Date: 07/03/1996 09:48:00
> 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.
No, it still uses the same port number. To do otherwise, the remote
machine would have to be asked to use a new 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)
> running simultaneously?
Each TCP connection is identified by the source address and port
*and* the destination address and port. So, for example, if machine A
starts up two UUCP (over TCP) sessions with machine B, the two
connections would be identified by something like
host A, port 1025 <-> host B, port 540
host A, port 1026 <-> host B, port 540
The TCP stack on the incoming machine looks at the source and
destination addresses and ports to find out which process to pass
the data on to.
Curt Sampson email@example.com Info at http://www.portal.ca/
Internet Portal Services, Inc.
Vancouver, BC (604) 257-9400 De gustibus, aut bene aut nihil.