ping_discover_network_plus 0.0.3 copy "ping_discover_network_plus: ^0.0.3" to clipboard
ping_discover_network_plus: ^0.0.3 copied to clipboard

Library that allows to ping IP subnet and discover network devices. Could be used to find printers and other devices and services in a local network.

example/main.dart

/*
 * ping_discover_network
 * Created by Andrey Ushakov
 * 
 * See LICENSE for distribution and usage details.
 */
import 'package:ping_discover_network_plus/ping_discover_network.dart';

/// Discover available network devices in a given subnet on a given port
void main() async {
  // NetworkAnalyzer.discover pings PORT:IP one by one according to timeout.
  // NetworkAnalyzer.discover2 pings all PORT:IP addresses at once.

  const port = 80;
  final stream = NetworkAnalyzer.i.discover2(
    '192.168.0',
    port,
    timeout: Duration(milliseconds: 5000),
  );

  int found = 0;
  stream.listen((NetworkAddress addr) {
    // print('${addr.ip}:$port');
    if (addr.exists) {
      found++;
      print('Found device: ${addr.ip}:$port');
    }
  }).onDone(() => print('Finish. Found $found device(s)'));
}
4
likes
0
pub points
86%
popularity

Publisher

verified publishermarcus.brasizza.com

Library that allows to ping IP subnet and discover network devices. Could be used to find printers and other devices and services in a local network.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, wifi_info_plugin_plus

More

Packages that depend on ping_discover_network_plus