Example #1
0
        protected virtual void OnClientDisconnected(ClientDisconnectedEventArgs e)
        {
            EventHandler <ClientDisconnectedEventArgs> handler = ClientDisconnected;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Example #2
0
 private void server_OnClientDisconnected(object sender, ClientDisconnectedEventArgs e)
 {
     try
     {
         Console.WriteLine("Client " + e.Client.ID + " disconnected!");
         server.ConnectedClients.Remove(e.Client);
         e.Client.TcpClient.Close();
         if (server.AcceptedClients.Contains(e.Client))
         {
             server.AcceptedClients.Remove(e.Client);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
 }