Search code examples
javasocketsservice-discovery

How to discover web servers on a local network?


Suppose I'm running several servers serving basic requests on my local network (say a home network, where all machines generally have an IP in the form K.K.K.x, where x is variable). Is there an easy way to discover all such servers? I would need to find each IP on the network running a particular java server application.


Solution

  • So you have a class C network... just attempt to open the particular server applications port on each IP address between 1 and 254. If you want to get fancy, you can do some checks to verify that if the port actually opens, it does what you expect for that application.