Answers for "c# socket listen on port"

C#
1

c# socket listen on port

IPHostEntry ipHostInfo = Dns.GetHostEntry(Dns.GetHostName());  
IPAddress ipAddress = ipHostInfo.AddressList[0];  
IPEndPoint localEndPoint = new IPEndPoint(ipAddress, 11000);  

Socket listener = new Socket(ipAddress.AddressFamily,
    SocketType.Stream, ProtocolType.Tcp);
listener.Bind(localEndPoint);  
listener.Listen(100); // specifies how many pending connections to the 
// Socket are allowed before a server busy error is returned to the connecting 
//client.
Posted by: Guest on December-07-2020

C# Answers by Framework

Browse Popular Code Answers by Language