Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

IPAddress.NetworkToHostOrder Method

Converts a number from network byte order to host byte order.

Overload List

Converts a short value from network byte order to host byte order.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Function NetworkToHostOrder(Short) As Short
[C#] public static short NetworkToHostOrder(short);
[C++] public: static short NetworkToHostOrder(short);
[JScript] public static function NetworkToHostOrder(Int16) : Int16;

Converts an integer value from network byte order to host byte order.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Function NetworkToHostOrder(Integer) As Integer
[C#] public static int NetworkToHostOrder(int);
[C++] public: static int NetworkToHostOrder(int);
[JScript] public static function NetworkToHostOrder(int) : int;

Converts a long value from network byte order to host byte order.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Function NetworkToHostOrder(Long) As Long
[C#] public static long NetworkToHostOrder(long);
[C++] public: static __int64 NetworkToHostOrder(__int64);
[JScript] public static function NetworkToHostOrder(long) : long;

Example

[Visual Basic, C#, C++] The following example uses the NetworkToHostOrder method to convert a long value from network byte order to host byte order.

[Visual Basic, C#, C++] Note   This example shows how to use one of the overloaded versions of NetworkToHostOrder. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
Public Sub NetworkToHostOrder_Long(networkByte As Long)
    Dim hostByte As Long
    ' Converts a long value from network byte order to host byte order.
    hostByte = IPAddress.NetworkToHostOrder(networkByte)
    Console.WriteLine("Network byte order to Host byte order of {0} is {1}", networkByte, hostByte)
End Sub 'NetworkToHostOrder_Long

[C#] 
public void NetworkToHostOrder_Long(long networkByte)
{
  long hostByte;
  // Converts a long value from network byte order to host byte order.
  hostByte = IPAddress.NetworkToHostOrder(networkByte);
  Console.WriteLine("Network byte order to Host byte order of {0} is {1}", networkByte, hostByte);
}

[C++] 
void NetworkToHostOrder_Long(__int64 networkByte) {
   __int64 hostByte;
   // Converts a long value from network Byte order to host Byte order.
   hostByte = IPAddress::NetworkToHostOrder(networkByte);
   Console::WriteLine(S"Network Byte order to Host Byte order of {0} is {1}",
      __box(networkByte), __box( hostByte));
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

IPAddress Class | IPAddress Members | System.Net Namespace

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.