new Socket : Socket Connection « Network « C# / C Sharp






new Socket

  

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();
    }
}

   
  








Related examples in the same category

1.Socket Connect, Send
2.Socket Exception
3.Socket property
4.Creating Socket Connections
5.Thread and socketThread and socket
6.New Multi Send
7.Multi Send
8.Multi Receive
9.Server Pool
10.SocketPool encapsulates the list of PooledSockets against one specific host, and contains methods for acquiring or returning PooledSockets.