How to know the latency proxy?

Hello everyone! There are for example a couple of proxies ip:port.
Connected to him this way:
using Microsoft.Win32;
using System.Diagnostics;
using System.Runtime.InteropServices;

[DllImport("wininet.dll")]
 public static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int dwBufferLength);

 public const int INTERNET_OPTION_SETTINGS_CHANGED = 39;
 public const int INTERNET_OPTION_REFRESH = 37;

 private void ConnectToProxy(string proxy)
{
 RegistryKey regKey = Registry.CurrentUser;
 regKey = regKey.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings");
 regKey.SetValue("ProxyEnable", 1); // 0 - disconnect 1 - connect 

 regKey.SetValue("ProxyServer", proxy);
regKey.Close();

 InternetSetOption(IntPtr.Zero, INTERNET_OPTION_SETTINGS_CHANGED, IntPtr.Zero, 0);
 InternetSetOption(IntPtr.Zero, INTERNET_OPTION_REFRESH, IntPtr.Zero, 0);

 ProcessStartInfo psi = new ProcessStartInfo(Environment.SystemDirectory + @"\netsh.exe", "winhttp import proxy source=ie");
Process.Start(psi);
 }


need to know latency(ping) proxy, how to do it?

P. S. Thank you very much!
June 10th 19 at 14:22
1 answer
June 10th 19 at 14:24
Solution
Ping pingSender = new Ping();
PingReply reply = pingSender.Send("8.8.8.8");

if (reply.Status == IPStatus.Success)
{
 Console.WriteLine("RoundTrip time: {0}", reply.RoundtripTime);
}

Find more questions by tags Proxy.NETC#