示例#1
0
 private void CloseAllClient()
 {
     foreach (IoSession session in clients)
     {
         ClientObject client = (ClientObject)session.GetAttribute(SERVER_KEY);
         session.CloseNow();
         clients.Remove(client);
         client.Dispose();
     }
 }
示例#2
0
        private void SessionClosed(object sender, IoSessionEventArgs e)
        {
            IPEndPoint remoreIP = (IPEndPoint)e.Session.RemoteEndPoint;

            Debug.Log(String.Format("client disconnect from {0} {1}", remoreIP.Address, remoreIP.Port));

            ClientObject client = (ClientObject)e.Session.GetAttribute(SERVER_KEY);

            clients.Remove(client);
            e.Session.RemoveAttribute(SERVER_KEY);
            client.Dispose();
        }