fn find_all_open_ports(ports: &PortCollection) -> Result<ScanReport> {
    let tc      = pcap::new_threading_context();
    let devices = EthernetDevice::list();

    let mut threads = Vec::new();

    for dev in devices {
        let pc     = ports.clone();
        let tc     = tc.clone();
        let handle = thread::spawn(move || {
            find_open_ports_in_network(tc, &dev, &pc)
        });

        threads.push(handle);
    }

    let mut report = ScanReport::new();

    for handle in threads {
        if let Ok(res) = handle.join() {
            report.merge(try!(res));
        } else {
            return Err(DiscoveryError::from("port scanner thread panicked"));
        }
    }

    Ok(report)
}
/// Find open ports on all available hosts within all local networks accessible
/// directly from this host.
Find open ports on all available hosts within all local networks accessible
directly from this host.
Find open ports on all available hosts within all local networks accessible directly from this host .
fn find_all_open_ports(ports: &PortCollection) -> Result<ScanReport> {
    let tc      = pcap::new_threading_context();
    let devices = EthernetDevice::list();
    let mut threads = Vec::new();
    for dev in devices {
        let pc     = ports.clone();
        let tc     = tc.clone();
        let handle = thread::spawn(move || {
            find_open_ports_in_network(tc, &dev, &pc)
        });
        threads.push(handle);
    }
    let mut report = ScanReport::new();
    for handle in threads {
        if let Ok(res) = handle.join() {
            report.merge(try!(res));
        } else {
            return Err(DiscoveryError::from("port scanner thread panicked"));
        }
    }
    Ok(report)
}
fn find_all_open_ports ( ports : & PortCollection ) -> Result < ScanReport > { let tc = pcap :: new_threading_context ( ) ; let devices = EthernetDevice :: list ( ) ; let mut threads = Vec :: new ( ) ; for dev in devices { let pc = ports . clone ( ) ; let tc = tc . clone ( ) ; let handle = thread :: spawn ( move | | { find_open_ports_in_network ( tc , & dev , & pc ) } ) ; threads . push ( handle ) ; } let mut report = ScanReport :: new ( ) ; for handle in threads { if let Ok ( res ) = handle . join ( ) { report . merge ( try ! ( res ) ) ; } else { return Err ( DiscoveryError :: from ( " " ) ) ; } } Ok ( report ) }
Find open ports on all available hosts within all local networks accessible
directly from this host.
Find open ports on all available hosts within all local networks accessible directly from this host .
ports
&PortCollection
ports
&PortCollection