What have you written so far?
try writing some pseudo code first
you will want an IP
and a specific range of ports to check.
you will need a method for sending a ping to them and a method for listening for a response (three part handshake for networking peeps)
you should start by writing something that can ping a local address, or even just something that can connect to a local machine to get the feel for how networking works.