Convert a long value from network byte order to host byte order in CSharp

Description

The following code shows how to convert a long value from network byte order to host byte order.

Example


using System;/*from   www .ja v a2 s.c om*/
using System.Net;
using System.Net.Sockets;

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

   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Network »




IP
Web Client