[ACCEPTED]-Client use high port number-ports
Servers listen on a fixed port number so 23 that clients will know where to connect. Clients 22 do not need to use a fixed port number, since 21 no one is initiating a connection to them, and 20 in fact they cannot use a fixed port number 19 if there may be more than one client running 18 on the same machine (e.g. a web browser) connecting 17 to the same server. IANA has designated ports in the range 16 0..49151 as fixed port numbers for specific 15 services, and ports in the range 49152..65535 14 as dynamic (ephemeral) ports which are not 13 assigned to any service and can be used 12 when a fixed port number is not required.
The 11 port range 0..49151 is further divided into 10 the well known range 0..1023, which only a privileged 9 process can bind to (at least on Unix/Linux), and 8 the registered range 1024..49151. Ports in the range 7 1024..49151 can be used by server processes 6 that may run as an unprivlieged user, and 5 it is also possible for clients to use ports 4 in this range if they are not being used 3 by a server (e.g. dynamic ports on Linux 2 and Solaris start at 32768 by default, rather 1 than 49152).
Ports numbers under 1024 are called "registered", while 16 those above (limit of 65,535) are called 15 "unregistered". All these two terms mean 14 is that ports under 1024 have standard services 13 associated with them. IE: 53 for DNS, 80 12 for HTTP, 25 for SMTP, etc. Note they are 11 associated - there is nothing to stop you 10 from setting your application to use port 9 53, 25, etc but it's not recommended because 8 other services will attempt to connect and 7 or operate on these ports so it could cause 6 problems.
The unregistered port region is 5 dynamically used by client applications. IE: You 4 are reading this answer while connecting 3 to port 80 of the StackOverflow.com webserver(s), but 2 your browser is using an unregistered port 1 to initiate that request.
Because server ports are usually well known ports. On a 7 Unix box you will see their assignment in 6 /etc/services
file. The client ports, on the other hand, are 5 usually picked by TCP/IP stack from the 4 specific high range. So servers know what 3 ports to listen on, clients know what port 2 to connect to, and nobody cares what port 1 the connection is made from.
Lower port numbers (< 1024) are reserved 7 to privileged processes. In addition, many 6 of these ports are assigned to specific 5 services by the Internet Assigned Number Authority. Clients establish connections 4 to servers listening on these well-known 3 ports, but use dynamically assigned port 2 numbers in the higher ranges according to 1 the ports that are available to them.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.