When you create a ServerSocket object, it attempts to bind to the port on the local host given by the port argument.
When you create a ServerSocket object, it attempts to bind to the port on the local host given by the port argument.
If another server socket is already listening to the port, then a java.net.BindException, a subclass of IOException, is thrown.
No more than one process or thread can listen to a particular port at a time. This includes non-Java processes or threads.
For example, if there's already an HTTP server running on port 80, you won't be able to bind to port 80.