134 questions
Hi 12586429,
using System;
using System.Net.NetworkInformation;
public class Program
{
public static void Main(string[] args)
{
string remoteIpAddress = "192.168.0.1"; // Replace by your remote IP machine
Ping pingSender = new Ping();
PingOptions options = new PingOptions();
byte[] buffer = new byte[32];
try
{
PingReply reply = pingSender.Send(remoteIpAddress, 1000, buffer, options);
if (reply.Status == IPStatus.Success)
{
Console.WriteLine($"Response time: {reply.RoundtripTime} ms");
}
else
{
Console.WriteLine($"Ping failed with status: {reply.Status}");
}
}
catch (PingException ex)
{
Console.WriteLine($"Ping failed error: {ex.Message}");
}
}
}
Regards,