static void Main(string[] args) { System.Console.WriteLine("Start"); var serverTcp = new ServerTCP(); try { Task.Run(serverTcp.Listen); System.Console.ReadKey(); } finally { serverTcp.Disconnect(); } }