Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Net;
- using System.Net.Sockets;
- namespace demo1
- {
- class Program
- {
- static void Main(string[] args)
- {
- IPAddress ia = IPAddress.Parse("127.0.0.1");
- IPEndPoint ie = new IPEndPoint(ia, 8000);
- Socket socket = new Socket(AddressFamily.InterNetwork,SocketType.Stream, ProtocolType.Tcp);
- Console.WriteLine("AddressFamily: {0}",socket.AddressFamily);
- Console.WriteLine("SocketType: {0}",socket.SocketType);
- Console.WriteLine("ProtocolType: {0}",socket.ProtocolType);
- Console.WriteLine("Blocking: {0}", socket.Blocking);
- socket.Blocking = false;
- Console.WriteLine("new Blocking: {0}",socket.Blocking);
- Console.WriteLine("Connected: {0}", socket.Connected);
- socket.Bind(ie);
- IPEndPoint iep = (IPEndPoint)socket.LocalEndPoint;
- Console.WriteLine("Local EndPoint: {0}",iep.ToString());
- socket.Close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement