16 private byte[] buffer;
44 this.ipStatus = ipStatus;
48 internal PingReply(
byte[] data,
int dataLength,
IPAddress address,
int time)
50 this.address = address;
52 ipStatus = GetIPStatus((IcmpV4Type)data[20], (IcmpV4Code)data[21]);
55 buffer =
new byte[dataLength - 28];
56 Array.
Copy(data, 28, buffer, 0, dataLength - 28);
64 internal PingReply(IcmpEchoReply reply)
66 address =
new IPAddress(reply.address);
70 rtt = reply.roundTripTime;
71 buffer =
new byte[reply.dataSize];
72 Marshal.
Copy(reply.data, buffer, 0, reply.dataSize);
73 options =
new PingOptions(reply.options);
81 internal PingReply(Icmp6EchoReply reply, IntPtr dataPtr,
int sendSize)
83 address =
new IPAddress(reply.Address.Address, reply.Address.ScopeID);
87 rtt = reply.RoundTripTime;
88 buffer =
new byte[sendSize];
89 Marshal.
Copy(IntPtrHelper.Add(dataPtr, 36), buffer, 0, sendSize);
97 private IPStatus GetIPStatus(IcmpV4Type type, IcmpV4Code code)
101 case IcmpV4Type.ICMP4_ECHO_REPLY:
103 case IcmpV4Type.ICMP4_SOURCE_QUENCH:
105 case IcmpV4Type.ICMP4_PARAM_PROB:
107 case IcmpV4Type.ICMP4_TIME_EXCEEDED:
109 case IcmpV4Type.ICMP4_DST_UNREACH:
112 case IcmpV4Code.ICMP4_UNREACH_NET:
113 return IPStatus.DestinationNetworkUnreachable;
114 case IcmpV4Code.ICMP4_UNREACH_HOST:
115 return IPStatus.DestinationHostUnreachable;
116 case IcmpV4Code.ICMP4_UNREACH_PROTOCOL:
117 return IPStatus.DestinationProtocolUnreachable;
118 case IcmpV4Code.ICMP4_UNREACH_PORT:
119 return IPStatus.DestinationPortUnreachable;
120 case IcmpV4Code.ICMP4_UNREACH_FRAG_NEEDED:
123 return IPStatus.DestinationUnreachable;
Provides an Internet Protocol (IP) address.
static void Copy(int[] source, int startIndex, IntPtr destination, int length)
Copies data from a one-dimensional, managed 32-bit signed integer array to an unmanaged memory pointe...
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Provides a collection of methods for allocating unmanaged memory, copying unmanaged memory blocks,...
static void Copy(Array sourceArray, Array destinationArray, int length)
Copies a range of elements from an T:System.Array starting at the first element and pastes them into ...
Manipulates arrays of primitive types.