Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

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.
 
PREVIOUS NEXT
Tagged: #socket #listen #port
ADD COMMENT
Topic
Name
4+9 =