Closed lxbzmy closed 11 years ago
Hello,
Actually, there's an API for port scanning, you have to send an Intent with the ACTION "info.lamatricexiste.network.SCAN_HOST" and the following extras,
Extras: HostBean.EXTRA_HOST Host to scan: i.e. scanme.nmap.org or an IP HostBean.EXTRA_POSITION Integer that will be put to the result intent HostBean.EXTRA_TIMEOUT Maximum time a port can be reached, AKA scan rate HostBean.EXTRA_PORTSO Integer array of already know open ports for this host HostBean.EXTRA_PORTSC Integer array of already know closed ports for this host
Of course, the extras have to be resolved (plain text or by importing the class HostBean).
Let me know if this work correctly and if that's what you're looking for.
Regards Aubort Jean-Baptiste
oh ,so quickly reply. But I mean,What API is to scan a IP ranges(1-254) and return available IP addresses to my program. Because destination device used DHCP and no UPNP feature. I can only use ip scan manner.
Ah, ok then there's no API for discovery, only port scanning. I would considere adding it as it's quite easy to do.
Thanks for the suggestion.
Rorist
On Mon, Mar 4, 2013 at 12:05 PM, lxbzmy notifications@github.com wrote:
oh ,so quickly reply. But I mean,What API is to scan A IP range and return available IP address for my program. Because destination device have used DHCP and have no UPNP feature. I can only use ip scan manner.
— Reply to this email directly or view it on GitHubhttps://github.com/rorist/android-network-discovery/issues/4#issuecomment-14375421 .
^-^. Or u can refactor a smart android lib project Than can to be include by other android project.
I made a small interface to split DisconveryActivity and DiscoveryTask:
/*
package info.lamatricexiste.network;
import info.lamatricexiste.network.Network.HostBean;
public interface HostDiscoveryProgressEvent {
/**
* called when discovery start.
* @param size ,how many IP(s) will be checked.
*/
public void onDiscoveryStart(long size);
/**
* called when a IP address checked
* @param host A available host ,or null.
*/
public void onDiscoveryProgressUpdate(HostBean host);
/**
* called when discovery finish();
* task finished.
*/
public void onDiscoveryStop();
/**
* called when discovery canceled by user or device.
*/
public void onDiscoveryCanceled();
}
and small DefaulDescovery Api patch:
/**
So I can directly use descoveryAsyncTask.
I'm a fresh android developer. and I need a ip scan solution for discovery my another device on wifi net. I write a simple scanner use thread and InetAddress.isReachable(int timeout). But it wok not good, too long time ,and not return exactly.
And I found u project very good.Thanks your work. I think u can create a small api version, for another project use. simply a API and return scanned ip.