// 新增一个用户账户到在线客户端 private void AddOnLine(NetAccount item) { lock (obj_lock) { all_accounts.Add(item); } UpdateOnlineClients( ); }
private void NetComplex_ClientOnline(AsyncStateOne object1) { // 回发一条初始化数据的信息 netComplex.Send(object1, 2, GetHistory( )); // 有客户端上限时触发方法 NetAccount account = new NetAccount( ) { Guid = object1.ClientUniqueID, Ip = object1.IpAddress, Name = object1.LoginAlias, OnlineTime = DateTime.Now, }; AddOnLine(account); }
private void NetComplex_ClientOnline(AppSession session) { // 回发一条初始化数据的信息 netComplex.Send(session, 2, GetHistory( )); // 有客户端上限时触发方法 NetAccount account = new NetAccount( ) { Guid = session.ClientUniqueID, Ip = session.IpAddress, Name = session.LoginAlias, OnlineTime = DateTime.Now, }; AddOnLine(account); }