What is the range of valid ports for a ServerSocket to listen to?

John Zukowski

You can create a server on ports 1 through 65535. Port numbers less than 256 are reserved for well-known services (like HTTP on port 80) and port numbers less than 1024 require root access on UNIX systems. Specifying a port of 0 in the ServerSocket constructor results in the server listening on a random, unused port, usually >= 1024.

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact