C# Programmation Réseau: Créer un Socket

Author:
  

using System;
using System.Net;
using System.Net.Sockets;
class SockProp {
    public static void Main() {
        IPAddress ia = IPAddress.Parse("127.0.0.1");
        IPEndPoint ie = new IPEndPoint(ia, 8000);
        Socket test = new Socket(AddressFamily.InterNetwork,SocketType.Stream, ProtocolType.Tcp);
        Console.WriteLine(test.AddressFamily);
        Console.WriteLine(test.SocketType);
        Console.WriteLine(test.ProtocolType);
        Console.WriteLine(test.Blocking);
        test.Blocking = false;
        Console.WriteLine(test.Blocking);
        Console.WriteLine(test.Connected);
        test.Bind(ie);
        IPEndPoint iep = (IPEndPoint)test.LocalEndPoint;
        Console.WriteLine(iep.ToString());
        test.Close();
    }
}

   
  

Leave a Reply

Your email address will not be published. Required fields are marked *