public static void Main(string[] args) { Console.WriteLine("Hello World!"); Client cli = new Client("127.0.0.1", 51718); cli.Connect(); if (!cli.isConnected()) { return; } ThreadTasks.CreatedSharedNetworkStream(cli.getStream()); ThreadTasks.InitialiseMutex("stream"); Thread listenThread = new Thread(new ThreadStart(ThreadTasks.ListenThread)); Thread sendThread = new Thread(new ThreadStart(ThreadTasks.SendThread)); listenThread.Start(); sendThread.Start(); while (ThreadTasks.ThreadsRunning()) { } listenThread.Abort(); sendThread.Abort(); listenThread.Join(); sendThread.Join(); ThreadTasks.DestroyMutex(); cli.Disconnect(); }