Subject: Re: [AAA-WG]: Support for multi-process

From: Jonathan Wood <[email-masked]>
Date: Mon, 11 Jun 2001 14:09:21 -0700 (PDT)

>
>I think there is some confusion here... There are two different issues at hand:
>1. enable multiple processes to run on the same machine
>2. make sure there is only one connection between any two processes (or 
>not, but that's another subjet)
>
>(1) requires that each process be assigned a distinct port or IP address. 
>You cannot have two processes listening on port 1812. You could have one on 
>1812 and one on 1813, for instance (don't know which other protocol I just 
>bumped into...).
>
>(2) requires either:
>- the use of SCTP which apparently solves the problem magically (don't know 
>how and why, haven't read the whole spec yet, but it was stated in some 
>previous e-mail).
>- the use of TCP with a complex state machine to make sure we tear down one 
>of the two connections if two are established at the same time
>- the use of TCP with the same port number of listening and accepting, as I 
>described.
>

I just checked the TCP spec on this (rfc793, section 3.4).
TCP and SCTP both handle the situation in the same way, i.e.
the two connections resolve into a single connection.

Just to be absolutely clear: this only happens when the
two connections are identical. For example, host A has
IP address 192.168.100.100 and the local port 1812, and
host B has IP address 192.168.200.200 and local port 1812.
(Note that this means, in socket terms, both are listening
on port 1812.) Now A and B then both try to connect() to
each other from port 1812 to port 1812. These two connections
are indistinguishable to both TCP and SCTP, and so *must*
resolve into a single connection.

If A or B had substitued any other port for their local
port (like a transient port), there would be two different
connections.

So if you allow connecting from transient ports, then yes,
you need to hack up the state machine to close one of
the connections down. If you always connect from a well-
known port, TCP and SCTP will take care of it for you.

Jonathan

---

From: David Mitton <[email-masked]>
Date: Tue, 12 Jun 2001 11:17:52 -0400

>known port, TCP and SCTP will take care of it for you.

There are no constraints on the value of the source port of the connection. 
It should be assumed to be an ephemeral port.  The well-known port is in 
use for listening.  A listening socket cannot make connections.

This is how most TCP protocols work.

Dave.

----------------------------------------------------
David Mitton                            978-288-4570
Advisor, Nortel Networks
[email-masked]   or      [email-masked]