From: Evan Martin (martine_at_danga.com)
Date: Sun Feb 22 2004 - 14:43:46 PST
On Sun, Feb 22, 2004 at 02:33:43PM -0800, Dung Nguyen wrote:
> My partner and I were working on the project today and we came across an
> issue. The assignment does not specify whether ports can be re-used or
> not, and since it was said that two-way byte streams could be built using
> two-way byte streams I was inclined to think that they could be. In this
> case, if we have two connections, one from (A:a)->(B:b) and the other
> (B:b)->(A:a). If A sends B a FIN packet, the information will be
> srcAddr:A, srcPort:a, destAddr:B, destAddr:b. Which connection should
> process it? You cannot tell from this information who is the "sender"
> and who is the "receiver".
As far as I can tell, your reasoning is correct.
> If it is the case that ports cannot be re-used, should we enforce this
> within our nodes, or can we assume that this is done already?
Ports can be re-used, in a sense. This setup
A:a -- B:b
B:b -- C:c
C:c -- A:a
could work as three separate connections.
In practice, though, the source port of a given connection is a randomly
chosen "unused" port, because it's the destination port that really
matters: the destination port determines which service or application
you're connecting to on the remote host.
Try running the command "netstat -t" on one of the attus to see the open
connections. It'll resolve addresses to hostnames and ports to service
names (for example, 22 is ssh: see the file /etc/services for a list)
by default, but "netstat -tn" will just show the numbers.
You'll see that in almost all cases, one side of the connection uses a
port up above 30,000, while the other side is a low, defined service
port less than 1000.
So: don't worry (or don't allow) connections that exactly mirror each
other. You can build a two-way byte stream using two one-way byte
streams that use different ports. Everything else ought to work fine.
-- Evan Martin martine_at_danga.com http://neugierig.org _______________________________________________ Cse461 mailing list Cse461_at_cs.washington.edu http://mailman.cs.washington.edu/mailman/listinfo/cse461
This archive was generated by hypermail 2.1.6 : Sun Feb 22 2004 - 14:48:50 PST