Convert an integer value from network byte order to host byte order in CSharp

Description

The following code shows how to convert an integer value from network byte order to host byte order.

Example


using System;/* w  w w  . ja v  a  2 s  . c o m*/
using System.Net;
using System.Net.Sockets;

public class Example
{
   public static void Main()
   {
      int hostByte;
      hostByte = IPAddress.NetworkToHostOrder(100);
      Console.WriteLine(hostByte);
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Network »




IP
Web Client