private void ComplexServer_AcceptString(Communication.Core.Net.AppSession session, NetHandle handle, string data) { // 接收字符串 logNet.WriteInfo($"[{session.IpEndPoint}] [{handle}] {data}"); // 举个例子,当handle==1时,回发一串信息 // for example , when handle == 1. return text if (handle == 1) { complexServer.Send(session, handle, "This is test Text"); } }
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); }