mscorlib(4.0.0.0) API with additions
IPAddress.cs
2 using System.Net.Sockets;
3 using System.Text;
4 
5 namespace System.Net
6 {
9  [global::__DynamicallyInvokable]
10  public class IPAddress
11  {
13  [global::__DynamicallyInvokable]
14  public static readonly IPAddress Any = new IPAddress(0);
15 
17  [global::__DynamicallyInvokable]
18  public static readonly IPAddress Loopback = new IPAddress(16777343);
19 
21  [global::__DynamicallyInvokable]
22  public static readonly IPAddress Broadcast = new IPAddress(4294967295L);
23 
25  [global::__DynamicallyInvokable]
26  public static readonly IPAddress None = Broadcast;
27 
28  internal const long LoopbackMask = 255L;
29 
30  internal long m_Address;
31 
32  [NonSerialized]
33  internal string m_ToString;
34 
36  [global::__DynamicallyInvokable]
37  public static readonly IPAddress IPv6Any = new IPAddress(new byte[16], 0L);
38 
40  [global::__DynamicallyInvokable]
41  public static readonly IPAddress IPv6Loopback = new IPAddress(new byte[16]
42  {
43  0,
44  0,
45  0,
46  0,
47  0,
48  0,
49  0,
50  0,
51  0,
52  0,
53  0,
54  0,
55  0,
56  0,
57  0,
58  1
59  }, 0L);
60 
62  [global::__DynamicallyInvokable]
63  public static readonly IPAddress IPv6None = new IPAddress(new byte[16], 0L);
64 
65  private AddressFamily m_Family = AddressFamily.InterNetwork;
66 
67  private ushort[] m_Numbers = new ushort[8];
68 
69  private long m_ScopeId;
70 
71  private int m_HashCode;
72 
73  internal const int IPv4AddressBytes = 4;
74 
75  internal const int IPv6AddressBytes = 16;
76 
77  internal const int NumberOfLabels = 8;
78 
82  [Obsolete("This property has been deprecated. It is address family dependent. Please use IPAddress.Equals method to perform comparisons. http://go.microsoft.com/fwlink/?linkid=14202")]
83  public long Address
84  {
85  get
86  {
87  if (m_Family == AddressFamily.InterNetworkV6)
88  {
89  throw new SocketException(SocketError.OperationNotSupported);
90  }
91  return m_Address;
92  }
93  set
94  {
95  if (m_Family == AddressFamily.InterNetworkV6)
96  {
97  throw new SocketException(SocketError.OperationNotSupported);
98  }
99  if (m_Address != value)
100  {
101  m_ToString = null;
102  m_Address = value;
103  }
104  }
105  }
106 
109  [global::__DynamicallyInvokable]
111  {
112  [global::__DynamicallyInvokable]
113  get
114  {
115  return m_Family;
116  }
117  }
118 
126  [global::__DynamicallyInvokable]
127  public long ScopeId
128  {
129  [global::__DynamicallyInvokable]
130  get
131  {
132  if (m_Family == AddressFamily.InterNetwork)
133  {
134  throw new SocketException(SocketError.OperationNotSupported);
135  }
136  return m_ScopeId;
137  }
138  [global::__DynamicallyInvokable]
139  set
140  {
141  if (m_Family == AddressFamily.InterNetwork)
142  {
143  throw new SocketException(SocketError.OperationNotSupported);
144  }
145  if (value < 0 || value > uint.MaxValue)
146  {
147  throw new ArgumentOutOfRangeException("value");
148  }
149  if (m_ScopeId != value)
150  {
151  m_Address = value;
152  m_ScopeId = value;
153  }
154  }
155  }
156 
157  internal bool IsBroadcast
158  {
159  get
160  {
161  if (m_Family == AddressFamily.InterNetworkV6)
162  {
163  return false;
164  }
165  return m_Address == Broadcast.m_Address;
166  }
167  }
168 
172  [global::__DynamicallyInvokable]
173  public bool IsIPv6Multicast
174  {
175  [global::__DynamicallyInvokable]
176  get
177  {
178  if (m_Family == AddressFamily.InterNetworkV6)
179  {
180  return (m_Numbers[0] & 0xFF00) == 65280;
181  }
182  return false;
183  }
184  }
185 
189  [global::__DynamicallyInvokable]
190  public bool IsIPv6LinkLocal
191  {
192  [global::__DynamicallyInvokable]
193  get
194  {
195  if (m_Family == AddressFamily.InterNetworkV6)
196  {
197  return (m_Numbers[0] & 0xFFC0) == 65152;
198  }
199  return false;
200  }
201  }
202 
206  [global::__DynamicallyInvokable]
207  public bool IsIPv6SiteLocal
208  {
209  [global::__DynamicallyInvokable]
210  get
211  {
212  if (m_Family == AddressFamily.InterNetworkV6)
213  {
214  return (m_Numbers[0] & 0xFFC0) == 65216;
215  }
216  return false;
217  }
218  }
219 
223  [global::__DynamicallyInvokable]
224  public bool IsIPv6Teredo
225  {
226  [global::__DynamicallyInvokable]
227  get
228  {
229  if (m_Family == AddressFamily.InterNetworkV6 && m_Numbers[0] == 8193)
230  {
231  return m_Numbers[1] == 0;
232  }
233  return false;
234  }
235  }
236 
240  [global::__DynamicallyInvokable]
241  public bool IsIPv4MappedToIPv6
242  {
243  [global::__DynamicallyInvokable]
244  get
245  {
246  if (AddressFamily != AddressFamily.InterNetworkV6)
247  {
248  return false;
249  }
250  for (int i = 0; i < 5; i++)
251  {
252  if (m_Numbers[i] != 0)
253  {
254  return false;
255  }
256  }
257  return m_Numbers[5] == ushort.MaxValue;
258  }
259  }
260 
266  [global::__DynamicallyInvokable]
267  public IPAddress(long newAddress)
268  {
269  if (newAddress < 0 || newAddress > uint.MaxValue)
270  {
271  throw new ArgumentOutOfRangeException("newAddress");
272  }
273  m_Address = newAddress;
274  }
275 
286  [global::__DynamicallyInvokable]
287  public IPAddress(byte[] address, long scopeid)
288  {
289  if (address == null)
290  {
291  throw new ArgumentNullException("address");
292  }
293  if (address.Length != 16)
294  {
295  throw new ArgumentException(SR.GetString("dns_bad_ip_address"), "address");
296  }
297  m_Family = AddressFamily.InterNetworkV6;
298  for (int i = 0; i < 8; i++)
299  {
300  m_Numbers[i] = (ushort)(address[i * 2] * 256 + address[i * 2 + 1]);
301  }
302  if (scopeid < 0 || scopeid > uint.MaxValue)
303  {
304  throw new ArgumentOutOfRangeException("scopeid");
305  }
306  m_ScopeId = scopeid;
307  }
308 
309  private IPAddress(ushort[] address, uint scopeid)
310  {
311  m_Family = AddressFamily.InterNetworkV6;
312  m_Numbers = address;
313  m_ScopeId = scopeid;
314  }
315 
322  [global::__DynamicallyInvokable]
323  public IPAddress(byte[] address)
324  {
325  if (address == null)
326  {
327  throw new ArgumentNullException("address");
328  }
329  if (address.Length != 4 && address.Length != 16)
330  {
331  throw new ArgumentException(SR.GetString("dns_bad_ip_address"), "address");
332  }
333  if (address.Length == 4)
334  {
335  m_Family = AddressFamily.InterNetwork;
336  m_Address = (((address[3] << 24) | (address[2] << 16) | (address[1] << 8) | address[0]) & uint.MaxValue);
337  return;
338  }
339  m_Family = AddressFamily.InterNetworkV6;
340  for (int i = 0; i < 8; i++)
341  {
342  m_Numbers[i] = (ushort)(address[i * 2] * 256 + address[i * 2 + 1]);
343  }
344  }
345 
346  internal IPAddress(int newAddress)
347  {
348  m_Address = (newAddress & uint.MaxValue);
349  }
350 
356  [global::__DynamicallyInvokable]
357  public static bool TryParse(string ipString, out IPAddress address)
358  {
359  address = InternalParse(ipString, tryParse: true);
360  return address != null;
361  }
362 
370  [global::__DynamicallyInvokable]
371  public static IPAddress Parse(string ipString)
372  {
373  return InternalParse(ipString, tryParse: false);
374  }
375 
376  private unsafe static IPAddress InternalParse(string ipString, bool tryParse)
377  {
378  if (ipString == null)
379  {
380  if (tryParse)
381  {
382  return null;
383  }
384  throw new ArgumentNullException("ipString");
385  }
386  if (ipString.IndexOf(':') != -1)
387  {
388  SocketException ex = null;
389  long num = 0L;
391  {
392  byte[] array = new byte[16];
393  SocketAddress socketAddress = new SocketAddress(AddressFamily.InterNetworkV6, 28);
394  if (UnsafeNclNativeMethods.OSSOCK.WSAStringToAddress(ipString, AddressFamily.InterNetworkV6, IntPtr.Zero, socketAddress.m_Buffer, ref socketAddress.m_Size) == SocketError.Success)
395  {
396  for (int i = 0; i < 16; i++)
397  {
398  array[i] = socketAddress[i + 8];
399  }
400  num = (socketAddress[27] << 24) + (socketAddress[26] << 16) + (socketAddress[25] << 8) + socketAddress[24];
401  return new IPAddress(array, num);
402  }
403  if (tryParse)
404  {
405  return null;
406  }
407  ex = new SocketException();
408  }
409  else
410  {
411  int start = 0;
412  if (ipString[0] != '[')
413  {
414  ipString += "]";
415  }
416  else
417  {
418  start = 1;
419  }
420  int end = ipString.Length;
421  fixed (char* name = ipString)
422  {
423  if (IPv6AddressHelper.IsValidStrict(name, start, ref end) || end != ipString.Length)
424  {
425  ushort[] array2 = new ushort[8];
426  string scopeId = null;
427  ushort[] array3 = array2;
428  fixed (ushort* numbers = array3)
429  {
430  IPv6AddressHelper.Parse(ipString, numbers, 0, ref scopeId);
431  }
432  if (scopeId == null || scopeId.Length == 0)
433  {
434  return new IPAddress(array2, 0u);
435  }
436  scopeId = scopeId.Substring(1);
437  if (uint.TryParse(scopeId, NumberStyles.None, null, out uint result))
438  {
439  return new IPAddress(array2, result);
440  }
441  }
442  }
443  if (tryParse)
444  {
445  return null;
446  }
447  ex = new SocketException(SocketError.InvalidArgument);
448  }
449  throw new FormatException(SR.GetString("dns_bad_ip_address"), ex);
450  }
451  Socket.InitializeSockets();
452  int end2 = ipString.Length;
453  long num2;
454  fixed (char* name2 = ipString)
455  {
456  num2 = IPv4AddressHelper.ParseNonCanonical(name2, 0, ref end2, notImplicitFile: true);
457  }
458  if (num2 == -1 || end2 != ipString.Length)
459  {
460  if (tryParse)
461  {
462  return null;
463  }
464  throw new FormatException(SR.GetString("dns_bad_ip_address"));
465  }
466  num2 = (((num2 & 0xFF) << 24) | (((num2 & 0xFF00) << 8) | (((num2 & 0xFF0000) >> 8) | ((num2 & 4278190080u) >> 24))));
467  return new IPAddress(num2);
468  }
469 
472  [global::__DynamicallyInvokable]
473  public byte[] GetAddressBytes()
474  {
475  byte[] array;
476  if (m_Family != AddressFamily.InterNetworkV6)
477  {
478  array = new byte[4]
479  {
480  (byte)m_Address,
481  (byte)(m_Address >> 8),
482  (byte)(m_Address >> 16),
483  (byte)(m_Address >> 24)
484  };
485  }
486  else
487  {
488  array = new byte[16];
489  int num = 0;
490  for (int i = 0; i < 8; i++)
491  {
492  array[num++] = (byte)((m_Numbers[i] >> 8) & 0xFF);
493  array[num++] = (byte)(m_Numbers[i] & 0xFF);
494  }
495  }
496  return array;
497  }
498 
502  [global::__DynamicallyInvokable]
503  public unsafe override string ToString()
504  {
505  if (m_ToString == null)
506  {
507  if (m_Family == AddressFamily.InterNetworkV6)
508  {
509  int addressStringLength = 256;
510  StringBuilder stringBuilder = new StringBuilder(addressStringLength);
512  {
513  SocketAddress socketAddress = new SocketAddress(AddressFamily.InterNetworkV6, 28);
514  int num = 8;
515  for (int i = 0; i < 8; i++)
516  {
517  socketAddress[num++] = (byte)(m_Numbers[i] >> 8);
518  socketAddress[num++] = (byte)m_Numbers[i];
519  }
520  if (m_ScopeId > 0)
521  {
522  socketAddress[24] = (byte)m_ScopeId;
523  socketAddress[25] = (byte)(m_ScopeId >> 8);
524  socketAddress[26] = (byte)(m_ScopeId >> 16);
525  socketAddress[27] = (byte)(m_ScopeId >> 24);
526  }
527  if (UnsafeNclNativeMethods.OSSOCK.WSAAddressToString(socketAddress.m_Buffer, socketAddress.m_Size, IntPtr.Zero, stringBuilder, ref addressStringLength) != 0)
528  {
529  throw new SocketException();
530  }
531  }
532  else
533  {
534  string value = string.Format(CultureInfo.InvariantCulture, "{0:x4}:{1:x4}:{2:x4}:{3:x4}:{4:x4}:{5:x4}:{6}.{7}.{8}.{9}", m_Numbers[0], m_Numbers[1], m_Numbers[2], m_Numbers[3], m_Numbers[4], m_Numbers[5], (m_Numbers[6] >> 8) & 0xFF, m_Numbers[6] & 0xFF, (m_Numbers[7] >> 8) & 0xFF, m_Numbers[7] & 0xFF);
535  stringBuilder.Append(value);
536  if (m_ScopeId != 0L)
537  {
538  stringBuilder.Append('%').Append((uint)m_ScopeId);
539  }
540  }
541  m_ToString = stringBuilder.ToString();
542  }
543  else
544  {
545  int num4 = 15;
546  char* ptr = stackalloc char[15];
547  int num5 = (int)((m_Address >> 24) & 0xFF);
548  do
549  {
550  ptr[--num4] = (char)(48 + num5 % 10);
551  num5 /= 10;
552  }
553  while (num5 > 0);
554  ptr[--num4] = '.';
555  num5 = (int)((m_Address >> 16) & 0xFF);
556  do
557  {
558  ptr[--num4] = (char)(48 + num5 % 10);
559  num5 /= 10;
560  }
561  while (num5 > 0);
562  ptr[--num4] = '.';
563  num5 = (int)((m_Address >> 8) & 0xFF);
564  do
565  {
566  ptr[--num4] = (char)(48 + num5 % 10);
567  num5 /= 10;
568  }
569  while (num5 > 0);
570  ptr[--num4] = '.';
571  num5 = (int)(m_Address & 0xFF);
572  do
573  {
574  ptr[--num4] = (char)(48 + num5 % 10);
575  num5 /= 10;
576  }
577  while (num5 > 0);
578  m_ToString = new string(ptr, num4, 15 - num4);
579  }
580  }
581  return m_ToString;
582  }
583 
587  [global::__DynamicallyInvokable]
588  public static long HostToNetworkOrder(long host)
589  {
590  return ((HostToNetworkOrder((int)host) & uint.MaxValue) << 32) | (HostToNetworkOrder((int)(host >> 32)) & uint.MaxValue);
591  }
592 
596  [global::__DynamicallyInvokable]
597  public static int HostToNetworkOrder(int host)
598  {
599  return ((HostToNetworkOrder((short)host) & 0xFFFF) << 16) | (HostToNetworkOrder((short)(host >> 16)) & 0xFFFF);
600  }
601 
605  [global::__DynamicallyInvokable]
606  public static short HostToNetworkOrder(short host)
607  {
608  return (short)(((host & 0xFF) << 8) | ((host >> 8) & 0xFF));
609  }
610 
614  [global::__DynamicallyInvokable]
615  public static long NetworkToHostOrder(long network)
616  {
617  return HostToNetworkOrder(network);
618  }
619 
623  [global::__DynamicallyInvokable]
624  public static int NetworkToHostOrder(int network)
625  {
626  return HostToNetworkOrder(network);
627  }
628 
632  [global::__DynamicallyInvokable]
633  public static short NetworkToHostOrder(short network)
634  {
635  return HostToNetworkOrder(network);
636  }
637 
642  [global::__DynamicallyInvokable]
643  public static bool IsLoopback(IPAddress address)
644  {
645  if (address == null)
646  {
647  throw new ArgumentNullException("address");
648  }
649  if (address.m_Family == AddressFamily.InterNetworkV6)
650  {
651  return address.Equals(IPv6Loopback);
652  }
653  return (address.m_Address & 0xFF) == (Loopback.m_Address & 0xFF);
654  }
655 
656  internal bool Equals(object comparandObj, bool compareScopeId)
657  {
658  IPAddress iPAddress = comparandObj as IPAddress;
659  if (iPAddress == null)
660  {
661  return false;
662  }
663  if (m_Family != iPAddress.m_Family)
664  {
665  return false;
666  }
667  if (m_Family == AddressFamily.InterNetworkV6)
668  {
669  for (int i = 0; i < 8; i++)
670  {
671  if (iPAddress.m_Numbers[i] != m_Numbers[i])
672  {
673  return false;
674  }
675  }
676  if (iPAddress.m_ScopeId == m_ScopeId)
677  {
678  return true;
679  }
680  if (!compareScopeId)
681  {
682  return true;
683  }
684  return false;
685  }
686  return iPAddress.m_Address == m_Address;
687  }
688 
693  [global::__DynamicallyInvokable]
694  public override bool Equals(object comparand)
695  {
696  return Equals(comparand, compareScopeId: true);
697  }
698 
701  [global::__DynamicallyInvokable]
702  public override int GetHashCode()
703  {
704  if (m_Family == AddressFamily.InterNetworkV6)
705  {
706  if (m_HashCode == 0)
707  {
709  }
710  return m_HashCode;
711  }
712  return (int)m_Address;
713  }
714 
715  internal IPAddress Snapshot()
716  {
717  switch (m_Family)
718  {
719  case AddressFamily.InterNetwork:
720  return new IPAddress(m_Address);
721  case AddressFamily.InterNetworkV6:
722  return new IPAddress(m_Numbers, (uint)m_ScopeId);
723  default:
724  throw new InternalException();
725  }
726  }
727 
730  [global::__DynamicallyInvokable]
732  {
733  if (AddressFamily == AddressFamily.InterNetworkV6)
734  {
735  return this;
736  }
737  return new IPAddress(new ushort[8]
738  {
739  0,
740  0,
741  0,
742  0,
743  0,
744  65535,
745  (ushort)(((m_Address & 0xFF00) >> 8) | ((m_Address & 0xFF) << 8)),
746  (ushort)(((m_Address & 4278190080u) >> 24) | ((m_Address & 0xFF0000) >> 8))
747  }, 0u);
748  }
749 
752  [global::__DynamicallyInvokable]
754  {
755  if (AddressFamily == AddressFamily.InterNetwork)
756  {
757  return this;
758  }
759  long newAddress = (uint)((int)((uint)(m_Numbers[6] & 0xFF00) >> 8) | ((m_Numbers[6] & 0xFF) << 8) | (((int)((uint)(m_Numbers[7] & 0xFF00) >> 8) | ((m_Numbers[7] & 0xFF) << 8)) << 16));
760  return new IPAddress(newAddress);
761  }
762  }
763 }
long Address
An Internet Protocol (IP) address.
Definition: IPAddress.cs:84
static readonly IPAddress Broadcast
Provides the IP broadcast address. This field is read-only.
Definition: IPAddress.cs:22
static CultureInfo InvariantCulture
Gets the T:System.Globalization.CultureInfo object that is culture-independent (invariant).
Definition: CultureInfo.cs:263
bool IsIPv6LinkLocal
Gets whether the address is an IPv6 link local address.
Definition: IPAddress.cs:191
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
bool IsIPv6SiteLocal
Gets whether the address is an IPv6 site local address.
Definition: IPAddress.cs:208
unsafe override string ToString()
Converts the value of this instance to a T:System.String.
int GetHashCode(object obj)
When overridden in a derived class, gets the hash code for the specified object.
static bool IsLoopback(IPAddress address)
Indicates whether the specified IP address is the loopback address.
Definition: IPAddress.cs:643
static readonly IPAddress Any
Provides an IP address that indicates that the server must listen for client activity on all network ...
Definition: IPAddress.cs:14
bool IsIPv6Teredo
Gets whether the address is an IPv6 Teredo address.
Definition: IPAddress.cs:225
Definition: __Canon.cs:3
The exception that is thrown when the value of an argument is outside the allowable range of values a...
bool IsIPv4MappedToIPv6
Gets whether the IP address is an IPv4-mapped IPv6 address.
Definition: IPAddress.cs:242
Implements the Berkeley sockets interface.
Definition: Socket.cs:16
IPAddress(byte[] address, long scopeid)
Initializes a new instance of the T:System.Net.IPAddress class with the address specified as a T:Syst...
Definition: IPAddress.cs:287
unsafe override string ToString()
Converts an Internet address to its standard notation.
Definition: IPAddress.cs:503
static long NetworkToHostOrder(long network)
Converts a long value from network byte order to host byte order.
Definition: IPAddress.cs:615
static IPAddress Parse(string ipString)
Converts an IP address string to an T:System.Net.IPAddress instance.
Definition: IPAddress.cs:371
override int GetHashCode()
Returns a hash value for an IP address.
Definition: IPAddress.cs:702
static bool TryParse(string ipString, out IPAddress address)
Determines whether a string is a valid IP address.
Definition: IPAddress.cs:357
The exception that is thrown when a socket error occurs.
NumberStyles
Determines the styles permitted in numeric string arguments that are passed to the Parse and TryParse...
Definition: NumberStyles.cs:10
Provides an Internet Protocol (IP) address.
Definition: IPAddress.cs:10
StringBuilder Append(char value, int repeatCount)
Appends a specified number of copies of the string representation of a Unicode character to this inst...
IPAddress(long newAddress)
Initializes a new instance of the T:System.Net.IPAddress class with the address specified as an T:Sys...
Definition: IPAddress.cs:267
static readonly IPAddress IPv6Any
The M:System.Net.Sockets.Socket.Bind(System.Net.EndPoint) method uses the F:System....
Definition: IPAddress.cs:37
AddressFamily
Specifies the addressing scheme that an instance of the T:System.Net.Sockets.Socket class can use.
Definition: AddressFamily.cs:5
A platform-specific type that is used to represent a pointer or a handle.
Definition: IntPtr.cs:14
IPAddress(byte[] address)
Initializes a new instance of the T:System.Net.IPAddress class with the address specified as a T:Syst...
Definition: IPAddress.cs:323
Stores serialized information from T:System.Net.EndPoint derived classes.
Definition: SocketAddress.cs:9
static readonly IPAddress Loopback
Provides the IP loopback address. This field is read-only.
Definition: IPAddress.cs:18
IPAddress MapToIPv6()
Maps the T:System.Net.IPAddress object to an IPv6 address.
Definition: IPAddress.cs:731
static int HostToNetworkOrder(int host)
Converts an integer value from host byte order to network byte order.
Definition: IPAddress.cs:597
static readonly IPAddress IPv6None
Provides an IP address that indicates that no network interface should be used. This property is read...
Definition: IPAddress.cs:63
long ScopeId
Gets or sets the IPv6 address scope identifier.
Definition: IPAddress.cs:128
Represents a mutable string of characters. This class cannot be inherited.To browse the ....
static StringComparer InvariantCultureIgnoreCase
Gets a T:System.StringComparer object that performs a case-insensitive string comparison using the wo...
bool IsIPv6Multicast
Gets whether the address is an IPv6 multicast global address.
Definition: IPAddress.cs:174
The exception that is thrown when one of the arguments provided to a method is not valid.
byte [] GetAddressBytes()
Provides a copy of the T:System.Net.IPAddress as an array of bytes.
Definition: IPAddress.cs:473
static readonly IPAddress IPv6Loopback
Provides the IP loopback address. This property is read-only.
Definition: IPAddress.cs:41
static readonly IntPtr Zero
A read-only field that represents a pointer or handle that has been initialized to zero.
Definition: IntPtr.cs:20
static readonly IPAddress None
Provides an IP address that indicates that no network interface should be used. This field is read-on...
Definition: IPAddress.cs:26
Specifies that the class can be serialized.
override bool Equals(object comparand)
Compares two IP addresses.
Definition: IPAddress.cs:694
static long HostToNetworkOrder(long host)
Converts a long value from host byte order to network byte order.
Definition: IPAddress.cs:588
static bool OSSupportsIPv6
Indicates whether the underlying operating system and network adaptors support Internet Protocol vers...
Definition: Socket.cs:268
IPAddress MapToIPv4()
Maps the T:System.Net.IPAddress object to an IPv4 address.
Definition: IPAddress.cs:753
Provides information about a specific culture (called a locale for unmanaged code development)....
Definition: CultureInfo.cs:16
static short NetworkToHostOrder(short network)
Converts a short value from network byte order to host byte order.
Definition: IPAddress.cs:633
static short HostToNetworkOrder(short host)
Converts a short value from host byte order to network byte order.
Definition: IPAddress.cs:606
static int NetworkToHostOrder(int network)
Converts an integer value from network byte order to host byte order.
Definition: IPAddress.cs:624
SocketError
Defines error codes for the T:System.Net.Sockets.Socket class.
Definition: SocketError.cs:5
Represents a string comparison operation that uses specific case and culture-based or ordinal compari...