How should I choose a port number for my server?

Answer Posted / chaitanya

The list of registered port assignments can be found in STD 2 or RFC 1700. Choose one that isn't already registered, and isn't in /etc/services on your system. It is also a good idea to let users customize the port number in case of conflicts with other un- registered port numbers in other servers. The best way of doing this is hardcoding a service name, and using getservbyname() to lookup the actual port number. This method allows users to change the port your server binds to by simply editing the /etc/services file.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a deep well socket?

523


What is the function of socket?

514


How do I use TCP_NODELAY?

1108


Is there any advantage to handling the signal, rather than just ignoring it and checking for the EPIPE error? Are there any useful parameters passed to the signal catching function?

1041


Can a single socket port be used for multiple applications?

456






What is socket address?

570


What is the difference between read() and recv()?

1593


What are the types of sockets?

494


How do unix sockets work?

491


How do I convert a string into an internet address?

909


What is af_inet in socket?

475


Are sockets files?

501


What pieces of information make up a socket?

546


Are unix sockets faster than tcp?

494


What's better 6pt or 12pt sockets?

480