• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why do we actually need ports?  RSS feed

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also a related question: Why do we actually need ports? I know, it identifies the service supplied by a server machine somewhere on any network. ex. SMTP Port 25. But is it standardised to be working at 25? One cannot configure it to be at 1024? (or anthing in the range [1024-65535] )
Wouldn't it be more convenient to embed the to-be-connected-service-info in the datagram without the port? what are +s and -s then?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The "port" formalism is just a handy way to refer to services on a machine. The designers of TCP/IP could have set things up so that a service name was transmitted instead of a number, but I think that would be far less convenient. It has no internationalization problems, for example, which textual names would.
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by R�stem e Zal:
{I}s SMTP standardised to be working at 25? One cannot configure it to be at 1024? (or anthing in the range [1024-65535] )
Wouldn't it be more convenient to embed the to-be-connected-service-info in the datagram without the port? what are +s and -s then?

You can configure SMTP to run on any port you like. However, if you want you communicate easily with SMTP services on other machines, it's easiest all the participants agree on a port address. For SMTP, port 25 is understood as the well-known port, that is, the address is established by convention rather than required by protocol.
For distributed programming, flexibility is prized over economy. But in the case of port conventions, you get the best of both worlds. You can pick any number in address range, although:
- Agreeing to a specific service port makes it far easier to play with others
- The first 1024 addresses are typically protected by administrator control, so for services that you don't want end-users mucking with, low port numbers are preferred.
- High numbers are typically used by these service programs as ephemeral port values, i.e., for creating sockets (a pair of ports, one for input, one for output) between two systems to sustain a session between two programs. Grabbing a high number to act as a service isn't a problem, but there's no particular advantage, unless using an obscure port to publish a service is what's wanted. Anybody who goes looking for that service with a port scanner application, however, won't have much trouble finding it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!