How should I choose a port number for my server?
Answer / 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 |
over the socket? Is there a way to have a dynamic buffer? What does one do when one does not know how much information is coming?
Explain the TIME_WAIT state.
What is the purpose of socket?
Why does it take so long to detect that the peer died?
How come select says there is data, but read returns zero?
What is LILO?
What is difference between socket () and serversocket () class?
If bind() fails, what should I do with the socket descriptor?
What are the pros/cons of select(), non-blocking I/O and SIGIO?
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?
How come only the first part of my datagram is getting through?
How do I get the port number for a given service?