java - Getting a list of servers listening on a specific port in android -
i'm developing android app used remote control pc android phone. managed develop functional app (client , server(java) app) except have specify client on ip connect. both client , server opening socket , listening on port 8998. there way of getting list of servers (on client side) listening on specific port?
thank in advance,
kristian
try { inetaddress serveraddress = inetaddress.getbyname(constants.server_ip); // getting inet adress of server networkinterface netinterface = networkinterface.getbyinetaddress(serveraddress); // getting interface name other servers should enumeration<inetaddress> addresses = netinterface.getinetaddresses(); (inetaddress inetaddress : collections.list(addresses)) { out.println("inetaddress: " + inetaddress); log.d("adresses", string.valueof(inetaddress)); } }catch(ioexception e){ log.e("err", "unknown hostname!"); }
is there way of getting list of servers (on client side) listening on specific port?
iterate on relevant ip addresses , see if can connect on port each of them. decide algorithm "all relevant ip addresses", though common 1 check on /24 subnet (e.g., if device's ip address 192.168.1.57, check 192.168.1.* addresses except 57).
Comments
Post a Comment