Нет.
Я решил идти в сторону Ping.
На просторах интернета нашел вот такой пример:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Net;
using System.ComponentModel;
namespace MMPing
{
public static class myPing
{
#region ICMP helper stuff
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
private struct ICMP_OPTIONS
{
public Byte Ttl;
public Byte Tos;
public Byte Flags;
public Byte OptionsSize;
public IntPtr OptionsData;
};
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
private struct ICMP_ECHO_REPLY
{
public int Address;
public int Status;
public int RoundTripTime;
public Int16 DataSize;
public Int16 Reserved;
public IntPtr DataPtr;
public ICMP_OPTIONS Options;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 250)]
public String Data;
}
[DllImport("iphlpapi.dll", SetLastError = true)]
private static extern IntPtr IcmpCreateFile();
[DllImport("iphlpapi.dll", SetLastError = true)]
private static extern bool IcmpCloseHandle(IntPtr handle);
[DllImport("iphlpapi.dll", SetLastError = true)]
private static extern Int32 IcmpSendEcho(IntPtr icmpHandle, Int32 destinationAddress, String requestData, Int32 requestSize, ref ICMP_OPTIONS requestOptions, ref ICMP_ECHO_REPLY replyBuffer, Int32 replySize, Int32 timeout);
#endregion
public static int Ping(IPAddress IP)
{
IntPtr ICMPHandle;
Int32 iIP;
String sData;
ICMP_OPTIONS oICMPOptions = new ICMP_OPTIONS();
ICMP_ECHO_REPLY ICMPReply = new ICMP_ECHO_REPLY();
Int32 iReplies;
ICMPHandle = IcmpCreateFile();
iIP = BitConverter.ToInt32(IP.GetAddressBytes(), 0);
sData = "x";
oICMPOptions.Ttl = 255;
iReplies = IcmpSendEcho(ICMPHandle, iIP,
sData, sData.Length, ref oICMPOptions, ref ICMPReply,
Marshal.SizeOf(ICMPReply), 30);
IcmpCloseHandle(ICMPHandle);
return iReplies;
}
}
}
код ошибок не выдает, но не работает ))) всегда возвращает 0.