Powershell AcceptTcpClient() cannot be interrupted by Ctrl-C
问题 I am writing a simple TCP/IP server using Powershell. I notice that Ctrl-C cannot interrupt the AcceptTcpClient() call. Ctrl-C works fine after the call though. I have searched around, nobody reported similar problem so far. The problem can be repeated by the following simple code. I am using Windows 10, latest patch, with the native Powershell terminal, not Powershell ISE. $listener=new-object System.Net.Sockets.TcpListener([system.net.ipaddress]::any, 4444) $listener.start() write-host