Thursday, 19 July 2007

How Ports Work

How Ports Work
Published by: frozenfire89
How Ports Work

No matter what you are doing on any network, whether it is the internet or simply on your home network, communications are done using ports.
Many people do not understand how ports work on a connection between computers. I would like to clarify this, in a simple manner for those who are wondering.

The essential methodology between computers is a Client-Server relationship; although there are a couple of different relationships on a connection, this is by-far the most common.
The way the Client-Server relationship (I will now refer to it as the CSR) works, is the server "listens" for a connection on a port. Behind this "listen" is a service, which will handle all connections to this port. On each port you can have only one service "bound".
When the client makes a request on that port, the computer's network interface directs that request to the service which has "bound" the port. The service receives this request, and sends a reply. The CSR now continues, where the client makes requests, and the server replies with the appropriate data.

What some people mix up with the CSR, is the way that ports are bound. It is a very common error to attempt to bind more than one service to a port. One example of this would be having both ISS and Apache attempting to bind the port. The first one to bind the port would succeed, but the latter one would not be able to, and would therefore fail.

Well, that's it for this somewhat vague, and probably erroneous article. Happy port binding!

No comments: