Innovenergy_trunk/csharp/lib/Utils/Net/PingExtensions.cs

14 lines
412 B
C#
Raw Normal View History

2023-02-16 12:57:06 +00:00
using CliWrap;
namespace InnovEnergy.Lib.Utils.Net;
public static class PingExtensions
{
private static Command PingCommand { get; } = Cli.Wrap("/bin/ping").WithValidation(CommandResultValidation.None);
public static async Task<Boolean> Ping(this String address)
{
var result = await PingCommand.WithArguments($"-c 1 {address}").ExecuteAsync();
return result.ExitCode == 0;
}
}