C# IPEndPoint IPEndPoint(Int64, Int32)

Description

IPEndPoint IPEndPoint(Int64, Int32) Initializes a new instance of the IPEndPoint class with the specified address and port number.

Syntax

IPEndPoint.IPEndPoint(Int64, Int32) has the following syntax.


public IPEndPoint(
  long address,
  int port
)

Parameters

IPEndPoint.IPEndPoint(Int64, Int32) has the following parameters.

  • address - The IP address of the Internet host.
  • port - The port number associated with the address, or 0 to specify any available port. port is in host order.

Example


using System;/*w w  w  . j  ava2 s .  c om*/
using System.Net;
using System.Net.Sockets;

public class Example
{
   public static void Main()
   {
            IPAddress hostIPAddress1 = IPAddress.Any;
      Console.WriteLine(hostIPAddress1.ToString());
      IPEndPoint hostIPEndPoint = new IPEndPoint(hostIPAddress1,80);
      Console.WriteLine("\nIPEndPoint information:" + hostIPEndPoint.ToString());
      Console.WriteLine("\n\tMaximum allowed Port Address :" + IPEndPoint.MaxPort);
      Console.WriteLine("\n\tMinimum allowed Port Address :" + IPEndPoint.MinPort);
      Console.WriteLine("\n\tAddress Family :" + hostIPEndPoint.AddressFamily);
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Net »




Cookie
Dns
IPAddress
IPEndPoint
IPHostEntry
WebClient