Exemple #1
0
 /// <summary>Converts a short value from network byte order to host byte order.</summary>
 /// <returns>A short value, expressed in host byte order.</returns>
 /// <param name="network">The number to convert, expressed in network byte order. </param>
 public static short NetworkToHostOrder(short network)
 {
     if (!BitConverter.IsLittleEndian)
     {
         return(network);
     }
     return(IPAddress.SwapShort(network));
 }
Exemple #2
0
 /// <summary>Converts a short value from host byte order to network byte order.</summary>
 /// <returns>A short value, expressed in network byte order.</returns>
 /// <param name="host">The number to convert, expressed in host byte order. </param>
 public static short HostToNetworkOrder(short host)
 {
     if (!BitConverter.IsLittleEndian)
     {
         return(host);
     }
     return(IPAddress.SwapShort(host));
 }