[Gllug] sorts of ports

Kieran Barry kieran at esperi.demon.co.uk
Sat Sep 1 12:43:14 UTC 2001


On Sat, 1 Sep 2001, Leigh Mason wrote:

> when a connection is made between two computers there is only one interface
> in action (modem for example)  that the data is being carried across. the
> interface has a 16 bit data register allowing the 65535 possible port
> numbers, but it is still just one physical port - right?

Port numbers feature in the TCP or UDP headers on packets. Basically,
the kernel on either end of a network connection needed a way to decide
which application needed the data. This is multiplexed based on:

Local  ip: Local  port
Remote ip: Remote port

As far as protocols go, your ethernet card can receive many
protocols: ARP, RARP, BOOTP, ICMP, UDP, TCP and IP packets just off the
top of my head. Port numbers are only significant for applications (ARP,
RARP etc tend to be kernel or network interface configuration tools.

> 
> is it just the program, say a web browser,  that will constantly send a read
> request to the modem port to check whether the data in the register is
> addresses to it (contains 80 in the address) and if an ftp app is running it
> also sends repeated read requests to the modem port to check it's data
> contains a 21 in it's address or whatever ???
> 
Obviously, the way networking works is abstracted, and I have my set of
images. The following works for me, although YMMV.

Anyway, your view assumes pull semantics. What actually happens is that
the kernel receives the packet from the modem, strips of the headers,
and passed the data to the relevant application when the app calls
"read() or readv() or whatever. I get the feeling that you don't make a
distinction between userspace and kernelspace.

> or am i barking up the wrong tree?
> 
Go to a good bookshop and browse "TCP/IP Illustrated Vol 2" which
explains how the BSD networking stack used to work around 95. The second
or third chapter explains how headers were added to the front of  a
linked list of mbufs. 

Regards

Kieran


-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list