ping_discover_network 0.0.2 copy "ping_discover_network: ^0.0.2" to clipboard
ping_discover_network: ^0.0.2 copied to clipboard

outdated

The library allows to ping IP subnet and therefore discover network devices. Could be used to find printers (for example, on port 9100) and other services in local network.

ping_discover_network #

Dart/Flutter library that allows to ping IP subnet and therefore discover network devices.

Could be used to find printers (for example, on port 9100) and other services in local network.

Getting Started #

Discover available network devices in a given subnet on a given port:

import 'package:ping_discover_network/ping_discover_network.dart';

final stream = NetworkAnalyzer.discover('192.168.0', 9100);

  stream.listen((NetworkAddress addr) {
    if (addr.exists) {
      print('Found device: ${addr.ip}');
    }
  }).onDone(() => print('Finish'));

Discover available network devices in a given subnet on a given port range:

import 'package:ping_discover_network/ping_discover_network.dart';

void checkPortRange(String subnet, int fromPort, int toPort) {
  if (fromPort > toPort) {
    return;
  }

  print('port $fromPort');

  final stream = NetworkAnalyzer.discover(subnet, fromPort);

  stream.listen((NetworkAddress addr) {
    if (addr.exists) {
      print('Found device: ${addr.ip}:$fromPort');
    }
  }).onDone(() {
    if (fromPort + 1 <= toPort) {
      checkPortRange(subnet, fromPort + 1, toPort);
    }
  });
}

checkPortRange('192.168.0', 400, 410);
70
likes
0
pub points
88%
popularity

Publisher

verified publishertablemi.com

The library allows to ping IP subnet and therefore discover network devices. Could be used to find printers (for example, on port 9100) and other services in local network.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on ping_discover_network