By default, a ServerSocket will listen on all available network interfaces, including each Ethernet card and localhost, as well as all virtual IP addresses mapped to the Ethernet
cards. You can restrict this by IP or hostname. This example is taken from Chapter 10, Sockets for Servers:
For example, login.ibiblio.org is a particular Linux box in North Carolina. It�s connected to the Internet with the IP address 152.2.210.122. The same box has a second Ethernet card with the local IP address 192.168.210.122 that is not visible from the public Internet, only from the local network. If for some reason I wanted to run a server on this host that only responded to local connections from within the same network, I could create a server socket that listens on port 5,776 of 192.168.210.122 but not on port 5,776 of 152.2.210.122, like so: