Next Previous Contents

6. Different Services: Email, Web, FTP, Name Serving

In the earlier example, we showed Netscape sending a TCP request to a web server running on another node. But imagine that the node with the web server is also running an Email server, an FTP server and a name server: how does it know which server the TCP connection is for?

This is where TCP and UDP have a concept of `ports'. Every packet has space for a `destination port', which says what service the packet is for. For example, TCP port 25 is the mail server, and TCP port 80 is the web server (although sometimes you find web servers on different ports). A list of ports can be found in `/etc/services'.

Also, if two Netscape windows are both accessing different parts of the same web site, how does the Linux box running Netscape sort out the TCP packets coming back from the web server?

This is where the `source port' comes in: every new TCP connection gets a different source port, so everyone can tell them apart, even if they are going to the same destination IP address and the same destination port. Usually the first source port given will be 1024, and will increase over time.


Next Previous Contents