Csharp/C Sharp by API/System.Net/IPEndPoint — различия между версиями

Материал из .Net Framework эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Текущая версия на 12:12, 26 мая 2010

IPEndPoint.AddressFamily

using System;
using System.Net;

class MainClass
{
    public static void Main()
    {
        IPAddress test1 = IPAddress.Parse("192.168.1.1");
      IPEndPoint ie = new IPEndPoint(test1, 8000);
    
      Console.WriteLine("The IPEndPoint is: {0}", ie.ToString());
      Console.WriteLine("The AddressFamily is: {0}", ie.AddressFamily);
      Console.WriteLine("The address is: {0}, and the port is: {1}", ie.Address, ie.Port);
    
    }
}


IPEndPoint.MaxPort

using System;
using System.Net;

class MainClass
{
    public static void Main()
    {
      Console.WriteLine("The min port number is: {0}", IPEndPoint.MinPort);
      Console.WriteLine("The max port number is: {0}\n", IPEndPoint.MaxPort);
    }
}


IPEndPoint.MinPort

using System;
using System.Net;

class MainClass
{
    public static void Main()
    {
      Console.WriteLine("The min port number is: {0}", IPEndPoint.MinPort);
      Console.WriteLine("The max port number is: {0}\n", IPEndPoint.MaxPort);
    }
}


IPEndPoint.Port

using System;
using System.Net;

class MainClass
{
    public static void Main()
    {
        IPAddress test1 = IPAddress.Parse("192.168.1.1");
      IPEndPoint ie = new IPEndPoint(test1, 8000);
    
      ie.Port = 80;
      Console.WriteLine("The changed IPEndPoint value is: {0}", ie.ToString());
    
    }
}


IPEndPoint.Serialize()

using System;
using System.Net;

class MainClass
{
    public static void Main()
    {
        IPAddress test1 = IPAddress.Parse("192.168.1.1");
      IPEndPoint ie = new IPEndPoint(test1, 8000);
    
      SocketAddress sa = ie.Serialize();
      Console.WriteLine("The SocketAddress is: {0}", sa.ToString());
    
    }
}


new IPEndPoint(IPAddress, int port)

using System;
using System.Net;

class MainClass
{
    public static void Main()
    {
        IPAddress test1 = IPAddress.Parse("192.168.1.1");
      IPEndPoint ie = new IPEndPoint(test1, 8000);
    
      Console.WriteLine("The IPEndPoint is: {0}", ie.ToString());
      Console.WriteLine("The AddressFamily is: {0}", ie.AddressFamily);
      Console.WriteLine("The address is: {0}, and the port is: {1}", ie.Address, ie.Port);
    
    }
}