14 lines
412 B
C#
14 lines
412 B
C#
|
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;
|
||
|
}
|
||
|
}
|