Android Example Subnet Scanner

Here is a simple subnet scanner. It scans the current class C subnet for a particular port number and tries to open a connection.

It logs all the IPs that are found to have that port open in a listview. I use it with my IoT gizmos on an Android 5.1 phone (just realize I have not tried on anything else).


It is a little more complicated than it needs to be. For one, the Starter module is unnecessary. But this is the structure I use for my network-aware apps where I like the socket to be opened in Starter so that I can keep it open when switching activities.
The Callback mechanism (Dispatch) can be used to steer the messages from the socket in the Starter module back to the proper, currently open activity.


  • Scanner
    4.2 KB · Views: 285
Last edited: