private void appServer_NewSessionConnected(CommonBinarySession session) { //if(!CurrentSession.TryAdd(session.SessionID, session)) //{ // listBox1.SetControlItem(string.Format("[error] {1}({0}) 连接上了服务器.但是当前用户列表已经发现相同的SessionId ", session.SessionID, session.RemoteEndPoint)); // session.Close(SuperSocket.SocketBase.CloseReason.Unknown); // return; //} ucLogMessageBox1.PrintShowLogMessage($" {session.RemoteEndPoint}({session.SessionID}) 连接上了服务器. "); var data = "Welcome to Server".ToSendData(CommonCommands.Text); session.Send(data); }
private void AppServer_SessionClosed(CommonBinarySession session, SuperSocket.SocketBase.CloseReason value) { ucLogMessageBox1.PrintShowLogMessage($" {session.RemoteEndPoint}({ session.SessionID}) 断开了连接({value})."); }