mscorlib(4.0.0.0) API with additions
IPPacketInformation.cs
1 namespace System.Net.Sockets
2 {
4  public struct IPPacketInformation
5  {
6  private IPAddress address;
7 
8  private int networkInterface;
9 
12  public IPAddress Address => address;
13 
16  public int Interface => networkInterface;
17 
18  internal IPPacketInformation(IPAddress address, int networkInterface)
19  {
20  this.address = address;
21  this.networkInterface = networkInterface;
22  }
23 
29  public static bool operator ==(IPPacketInformation packetInformation1, IPPacketInformation packetInformation2)
30  {
31  return packetInformation1.Equals(packetInformation2);
32  }
33 
39  public static bool operator !=(IPPacketInformation packetInformation1, IPPacketInformation packetInformation2)
40  {
41  return !packetInformation1.Equals(packetInformation2);
42  }
43 
48  public override bool Equals(object comparand)
49  {
50  if (comparand == null)
51  {
52  return false;
53  }
54  if (!(comparand is IPPacketInformation))
55  {
56  return false;
57  }
58  IPPacketInformation iPPacketInformation = (IPPacketInformation)comparand;
59  if (address.Equals(iPPacketInformation.address) && networkInterface == iPPacketInformation.networkInterface)
60  {
61  return true;
62  }
63  return false;
64  }
65 
68  public override int GetHashCode()
69  {
70  return address.GetHashCode() + networkInterface.GetHashCode();
71  }
72  }
73 }
static bool operator !=(IPPacketInformation packetInformation1, IPPacketInformation packetInformation2)
Tests whether two specified T:System.Net.Sockets.IPPacketInformation instances are not equal.
static bool operator==(IPPacketInformation packetInformation1, IPPacketInformation packetInformation2)
Tests whether two specified T:System.Net.Sockets.IPPacketInformation instances are equivalent.
override int GetHashCode()
Returns a hash value for an IP address.
Definition: IPAddress.cs:702
IPAddress Address
Gets the origin information of the packet that was received as a result of calling the M:System....
Provides an Internet Protocol (IP) address.
Definition: IPAddress.cs:10
override int GetHashCode()
Returns the hash code for this instance.
override bool Equals(object comparand)
Returns a value that indicates whether this instance is equal to a specified object.
Presents the packet information from a call to M:System.Net.Sockets.Socket.ReceiveMessageFrom(System....
int Interface
Gets the network interface information that is associated with a call to M:System....