[comp.protocols.tcp-ip] Ignorant question - multiple connections within TCP ports?

bryan@geo-works.UUCP (Bryan Ford) (07/15/89)

I've been reading a book about the TCP/IP suite, and I have a question
(concern) about the TCP protocol.  It appears to me from reading this book
that you can have one separate TCP connection for each port on a single
host.  For example, if someone connects to port 2 on a host, someone else
can connect to port 3 on the same host, and have two independent
connections - correct?  However, is there a way that there can be more than
one connection to a single port?  For example, if someone connects to port
21 on a host to do some FTP stuff, then someone else tries to also connect
to port 21 on the same host while the first connection is still going, what
happens?  Does the request get denied, or does another FTP server process
get started up, or what?

I hope I've been clear enough.  I've been searching all over this book for
information on this, but can't find anything.

Thanks for your help!

				Bryan

--

     _______________________________________
   _/   Bryan Ford - bryan@geo-works.uucp   \_
 _/  ..!utah-cs!caeco!i-core!geo-works!bryan  \_
/ ..!uunet!iconsys!caeco!i-core!geo-works!bryan \

heberlei@iris.ucdavis.edu (Todd) (07/19/89)

In article <1765.AA1765@geo-works> bryan@geo-works.UUCP (Bryan Ford) writes:
>I've been reading a book about the TCP/IP suite, and I have a question
>(concern) about the TCP protocol.  It appears to me from reading this book
>that you can have one separate TCP connection for each port on a single
>host.  For example, if someone connects to port 2 on a host, someone else
>can connect to port 3 on the same host, and have two independent
>connections - correct?  However, is there a way that there can be more than
>one connection to a single port?  For example, if someone connects to port
>21 on a host to do some FTP stuff, then someone else tries to also connect
>to port 21 on the same host while the first connection is still going, what
>happens?  Does the request get denied, or does another FTP server process
>get started up, or what?
>
>I hope I've been clear enough.  I've been searching all over this book for
>information on this, but can't find anything.
>
>Thanks for your help!
>
>				Bryan
>   _/   Bryan Ford - bryan@geo-works.uucp   \_

This does happen.  For example if two people from host A
login into host B, the port on B for both connections will be port
513 (the default port for login I believe).  Host B can then separate
the connections by:

 (1) source ports of the originating connection (from host A)
        or
 (2) sequence / acknowledgement numbers of the separate connections

I was once told that (2) was the correct answer.
The question I have is: If the connections are separated by seq/ack
numbers as I have been told, what would happen if the seq. number from
one connection passed the seq. number for another connection?

Note:
There are a number of ports used for certain services (ie. finger,
telnet, ftp, ftp-data, etc).  All hosts logging into host B will use
the same port on host B (513).  However, I have yet to see the ports
of two connections have both the same source and destination ports (eg
two connections from host A to host B using ports 1025 (on A) and 513
(on B)).  Thus by experience, I am starting to believe answer (1) is
correct.

WOULD SOMEONE THAT KNOWS THE ACTUAL SPECS. PLEASE HELP US OUT?


Todd Heberlein

smb@ulysses.homer.nj.att.com (Steven M. Bellovin) (07/19/89)

In article <4908@ucdavis.ucdavis.edu>, heberlei@iris.ucdavis.edu (Todd) writes:
> In article <1765.AA1765@geo-works> bryan@geo-works.UUCP (Bryan Ford) writes:
> >It appears to me from reading this book
> >that you can have one separate TCP connection for each port on a single
> >host.  For example, if someone connects to port 2 on a host, someone else
> >can connect to port 3 on the same host, and have two independent
> >connections - correct?  However, is there a way that there can be more than
> >one connection to a single port?  For example, if someone connects to port
> >21 on a host to do some FTP stuff, then someone else tries to also connect
> >to port 21 on the same host while the first connection is still going, what
> >happens?  Does the request get denied, or does another FTP server process
> >get started up, or what?
> 
> This does happen.  For example if two people from host A
> login into host B, the port on B for both connections will be port
> 513 (the default port for login I believe).  Host B can then separate
> the connections by:
> 
>  (1) source ports of the originating connection (from host A)
>         or
>  (2) sequence / acknowledgement numbers of the separate connections
> 
> I was once told that (2) was the correct answer.

Connections are distinguished by the 4-tuple

	<localhost,localport,remotehost,remoteport>

If two people from A request the same service of B at the same time,
they will have different port numbers on A.  For some operating
systems, two users on A can each use the same local port number
to request the same service on two different hosts B and C.  It
is illegal for A's TCP to assign the same local port number to
two connections if both are destined for the same port on B; if A
does this, it's broken.

Sequence numbers are *not* used to disambiguate in this case.  They come
into play only to distinguish between the current connection and old
packets floating around the net from previous instantiations of the
same connection (i.e., the same 4-tuple).  That topic gets rather
involved, and I think I'll pass on explaining it till another posting.

And yes, before you ask, I'm utterly certain that my answer is correct.

		--Steve Bellovin

henry@utzoo.uucp (Henry Spencer) (07/20/89)

In article <1765.AA1765@geo-works> bryan@geo-works.UUCP (Bryan Ford) writes:
>I hope I've been clear enough.  I've been searching all over this book for
>information on this, but can't find anything.

Sigh, this is Comer's book, right?  You *will* actually find this important
point discussed... in the appendix on the 4.3BSD interface!  Pray for a
revised second edition sometime soon...
-- 
$10 million equals 18 PM       |     Henry Spencer at U of Toronto Zoology
(Pentagon-Minutes). -Tom Neff  | uunet!attcan!utzoo!henry henry@zoo.toronto.edu

zepf@optis31.UUCP (Tom Zepf) (07/20/89)

In article <1765.AA1765@geo-works> bryan@geo-works.UUCP (Bryan Ford) writes:
>connections - correct?  However, is there a way that there can be more than
>one connection to a single port?  For example, if someone connects to port
>21 on a host to do some FTP stuff, then someone else tries to also connect
>to port 21 on the same host while the first connection is still going, what
>happens?  Does the request get denied, or does another FTP server process
>get started up, or what?

Each TCP connection in a network is distinguished by these four items:

	Peer #1 Address
	Peer #1 Port
	Peer #2 Address
	Peer #2 Port

No two connections may exist with exactly the same values. This usually
enforced by the peers' operating systems.

FTP uses the client's address and port to distinguish multiple
connections to the same server port.

-- 
Tom Zepf					Optigraphics Corporation
scubed!optis31!zepf				9339 Carroll Park Drive
seismo!esosun!optis31!zepf			San Diego, CA 92121

sgf@brunix (Sam Fulcomer) (07/20/89)

In article <11902@ulysses.homer.nj.att.com> smb@ulysses.homer.nj.att.com (Steven M. Bellovin) writes:
>In article <4908@ucdavis.ucdavis.edu>, heberlei@iris.ucdavis.edu (Todd) writes:
>> In article <1765.AA1765@geo-works> bryan@geo-works.UUCP (Bryan Ford) writes:
>> >It appears to me from reading this book that you can have one separate TCP 
>> >connection for each port on a single host.  

Unfortunately some implementations of IP do not allow multiple connections
on listening ports (but then they're not real implementations...). Exos on
a Plexus comes to mind...

Try it, and if it doesn't work it's broken.

Sam
sgf@cfm.brown.edu

ww0n+@ANDREW.CMU.EDU (Walter Lloyd Wimer III) (07/22/89)

From RFC 793 (Transmission Control Protocol):

 Multiplexing:

    To allow for many processes within a single Host to use TCP
    communication facilities simultaneously, the TCP provides a set of
    addresses or ports within each host.  Concatenated with the network
    and host addresses from the internet communication layer, this forms
    a socket.  A pair of sockets uniquely identifies each connection.
    That is, a socket may be simultaneously used in multiple
    connections.


So in other words, just as two points determine a line in mathematics,
two sockets determine a connection in TCP.


Walt Wimer
Network Development
Carnegie Mellon University

CERF@A.ISI.EDU (07/22/89)

The CALLING PORT is supposed to be selected at Host A to be distinct
for each TCP connection initiated. Thus, the well-known target
Host B port (513) can be the same for both connections, but the
two are distinguished by the port pairs:

Connection 1: Port A1 on Host A, Port 513 on HOst B
Connection 2: Port A2 on Host A, port 513 on Host B.

The second option you cite is flat wrong.

Vint Cerf