IPAddress.HostToNetworkOrder 方法

定义

将值由主机字节顺序转换为网络字节顺序。Converts a value from host byte order to network byte order.

重载

HostToNetworkOrder(Int16)

将短值由主机字节顺序转换为网络字节顺序。Converts a short value from host byte order to network byte order.

HostToNetworkOrder(Int32)

将整数值由主机字节顺序转换为网络字节顺序。Converts an integer value from host byte order to network byte order.

HostToNetworkOrder(Int64)

将长值由主机字节顺序转换为网络字节顺序。Converts a long value from host byte order to network byte order.

HostToNetworkOrder(Int16)

将短值由主机字节顺序转换为网络字节顺序。Converts a short value from host byte order to network byte order.

public:
 static short HostToNetworkOrder(short host);
public static short HostToNetworkOrder (short host);
static member HostToNetworkOrder : int16 -> int16
Public Shared Function HostToNetworkOrder (host As Short) As Short

参数

host
Int16

以主机字节顺序表示的要转换的数字。The number to convert, expressed in host byte order.

返回

Int16

以网络字节顺序表示的短值。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 that are sent over the network are sent in network byte order which has the most significant byte first.

HostToNetworkOrder方法将主机系统上存储的多字节整数值从主机使用的字节顺序转换为网络使用的字节顺序。The HostToNetworkOrder method converts multibyte integer values that are stored on the host system from the byte order used by the host to the byte order used by the network.

另请参阅

适用于

HostToNetworkOrder(Int32)

将整数值由主机字节顺序转换为网络字节顺序。Converts an integer value from host byte order to network byte order.

public:
 static int HostToNetworkOrder(int host);
public static int HostToNetworkOrder (int host);
static member HostToNetworkOrder : int -> int
Public Shared Function HostToNetworkOrder (host As Integer) As Integer

参数

host
Int32

以主机字节顺序表示的要转换的数字。The number to convert, expressed in host byte order.

返回

Int32

以网络字节顺序表示的整数值。An integer 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 that are sent over the network are sent in network byte order which has the most significant byte first.

HostToNetworkOrder方法将主机系统上存储的多字节整数值从主机使用的字节顺序转换为网络使用的字节顺序。The HostToNetworkOrder method converts multibyte integer values that are stored on the host system from the byte order used by the host to the byte order used by the network.

另请参阅

适用于

HostToNetworkOrder(Int64)

将长值由主机字节顺序转换为网络字节顺序。Converts a long value from host byte order to network byte order.

public:
 static long HostToNetworkOrder(long host);
public static long HostToNetworkOrder (long host);
static member HostToNetworkOrder : int64 -> int64
Public Shared Function HostToNetworkOrder (host As Long) As Long

参数

host
Int64

以主机字节顺序表示的要转换的数字。The number to convert, expressed in host byte order.

返回

Int64

以网络字节顺序表示的长值。A long 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 that are sent over the network are sent in network byte order which has the most significant byte first.

HostToNetworkOrder方法将主机系统上存储的多字节整数值从主机使用的字节顺序转换为网络使用的字节顺序。The HostToNetworkOrder method converts multibyte integer values that are stored on the host system from the byte order used by the host to the byte order used by the network.

另请参阅

适用于