HostToNetworkOrder Method (Int16)
Collapse the table of content
Expand the table of content

IPAddress.HostToNetworkOrder Method (Int16)

.NET Framework 1.1

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

[Visual Basic]
Overloads Public Shared Function HostToNetworkOrder( _
   ByVal host As Short _
) As Short
public static short HostToNetworkOrder(
 short host
public: static short HostToNetworkOrder(
 short host
public static function HostToNetworkOrder(
   host : Int16
) : Int16;


The number to convert, expressed in host byte order.

Return Value

A short value, expressed in network byte order.


Different computers use different conventions for ordering the bytes within multibyte integer values. Some computers put the most significant byte first (known as big-endian order) and others put the least-significant byte first (known as little-endian order). To work with computers that use different byte ordering, all integer values sent over the network are sent in network byte order.

The HostToNetworkOrder method converts multibyte integer values stored on the host system from the byte order used by the host to the byte order used by the network.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

IPAddress Class | IPAddress Members | System.Net Namespace | IPAddress.HostToNetworkOrder Overload List | NetworkToHostOrder

© 2016 Microsoft