Cancel blocking AcceptTcpClient call
问题 As everyone may already know, the simplest way to accept incoming TCP connections in C# is by looping over TcpListener.AcceptTcpClient(). Additionally this way will block code execution until a connection is obtained. This is extremely limiting to a GUI, so I want to listen for connections in either a seperate thread or task. I have been told, that threads have several disadvantages, however nobody explained me what these are. So instead of using threads, I used tasks. This works great,