How to set up TcpListener to always listen and accept multiple connections?

The socket on which you want to listen for incoming connections is commonly referred to as the listening socket. When the listening socket acknowledges an incoming connection, a socket that commonly referred to as a child socket is created that effectively represents the remote endpoint. In order to handle multiple client connections simultaneously, you will … Read more

Difference between TCP Listener and Socket

TcpListener is a convenient wrapper for TCP communications. This allows you to use TcpClient for accepted connections–although you can accept sockets instead of clients to use Socket instead of TcpClient. You can do the same thing with Socket; but you have to deal with some of the TCP-specifics (like SocketType.Stream, ProtocolType.Tcp). TCP is a stream-based … Read more

Proper way to stop TcpListener

These are two quick fixes you can use, given the code and what I presume is your design: 1. Thread.Abort() If you have started this TcpListener thread from another, you can simply call Abort() on the thread, which will cause a ThreadAbortException within the blocking call and walk up the stack. 2. TcpListener.Pending() The second … Read more

How many socket connections can a web server handle?

In short: You should be able to achieve in the order of millions of simultaneous active TCP connections and by extension HTTP request(s). This tells you the maximum performance you can expect with the right platform with the right configuration. Today, I was worried whether IIS with ASP.NET would support in the order of 100 … Read more