Skip to content

Commit

Permalink
Merge pull request #194 from osociety/codepage
Browse files Browse the repository at this point in the history
Force codepage for windows
  • Loading branch information
git-elliot authored Mar 30, 2024
2 parents 1de5f18 + 90a886c commit d829d4a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
7 changes: 6 additions & 1 deletion lib/src/models/active_host.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,12 @@ class ActiveHost {

PingData tempPingData = const PingData();

Ping(host, count: 1, timeout: timeoutInSeconds).stream.listen((pingData) {
Ping(
host,
count: 1,
timeout: timeoutInSeconds,
forceCodepage: Platform.isWindows,
).stream.listen((pingData) {
final PingResponse? response = pingData.response;
if (response != null) {
final Duration? time = response.time;
Expand Down
9 changes: 7 additions & 2 deletions lib/src/services/impls/host_scanner_service_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:dart_ping/dart_ping.dart';
import 'package:network_tools/network_tools.dart';
import 'package:network_tools/src/network_tools_utils.dart';
import 'package:network_tools/src/services/arp_service.dart';
import 'package:universal_io/io.dart';

/// Scans for all hosts in a subnet.
class HostScannerServiceImpl extends HostScannerService {
Expand Down Expand Up @@ -106,8 +107,12 @@ class HostScannerServiceImpl extends HostScannerService {
}) async {
SendableActiveHost? tempSendableActivateHost;

await for (final PingData pingData
in Ping(host, count: 1, timeout: timeoutInSeconds).stream) {
await for (final PingData pingData in Ping(
host,
count: 1,
timeout: timeoutInSeconds,
forceCodepage: Platform.isWindows,
).stream) {
final PingResponse? response = pingData.response;
final PingError? pingError = pingData.error;
if (response != null) {
Expand Down

0 comments on commit d829d4a

Please sign in to comment.