Thursday, March 24, 2011

Socket Programming - Part 1

Reference: http://www.tenouk.com/cnlinuxsockettutorials.html

Port Numbers
  • 16 bit integers
  • So a maximum port numbers are 2^16 = 65536 (0 to 65535)
  • Unique with a machine/IP address
  • Each service/application/daemon will have their own port number 
  • Required to make a connection (along with its host IP address)
Server & Client Port Numbers
  • Connection is defined by: (Server IP and Port number) + (Client IP and port number)
  • Server Port numbers are low numbers in the range 1 - 1023 (called as WELL KNOWN PORT NUMBER)
  • Accessible only by Administrators (roots, in linux)
  • Used for authentication
  • A server running on a well-known port lets the OS know what port it wants to listen on
  • Normally, client port numbers are higher number starting at 1024
  • Client normally simples lets the OS picks a new port that is not already in use.

No comments:

Post a Comment