Example #1
0
        /// <summary>Disconnects the client and stops all network traffic.</summary>
        public void Disconnect()
        {
            Console.WriteLine($"{tcp?.tcpClient.Client.RemoteEndPoint} has disconnected.");

            Server.RemoveClient(Id);

            tcp?.Disconnect();
            udp?.Disconnect();
        }
Example #2
0
        public void Disconnect()
        {
            if (isConnected)
            {
                isConnected = false;
                tcp?.Disconnect();
                udpSend?.Disconnect();

                Console.WriteLine("Disconnected from server.");
                Environment.Exit(-1);
            }
        }