IPAddress.HostToNetworkOrder 方法

定義

將值從主機位元組順序轉換為網路位元組順序。Converts a value from host byte order to network byte order.

多載

HostToNetworkOrder(Int16)

將短整數 (Short) 值從主機位元組順序轉換為網路位元組順序。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)

將長整數 (Long) 值從主機位元組順序轉換為網路位元組順序。Converts a long value from host byte order to network byte order.

HostToNetworkOrder(Int16)

將短整數 (Short) 值從主機位元組順序轉換為網路位元組順序。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.

傳回

以網路位元組順序表示的短整數值。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.

傳回

以網路位元組順序表示的整數值。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)

將長整數 (Long) 值從主機位元組順序轉換為網路位元組順序。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.

傳回

以網路位元組順序表示的長整數值。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.

另請參閱

適用於