/// <summary> /// /// </summary> /// <param name="Message"></param> protected void HandleLoginOKMessage(LoginOKMessage Message) { // set connection state connectionState = ConnectionState.Authenticated; // log Logger.Log(MODULENAME, LogType.Info, "ConnectionState: Authenticated"); }
private void Login(LoginOKMessage mess) { try { if (!mess.Code.Equals("0000")) { status = string.Format("[{0}]连接公告服务器失败({1},{2})", DateTime.Now.ToLocalTime(), mess.Code, mess.Mess); Thread.Sleep(0x3e8); this.ReConnectServer(); } else { status = string.Format("[{0}]连接公告服务器成功({1}:{2})", DateTime.Now.ToLocalTime(), this.client.ServerPoint.Address.ToString(), this.client.ServerPoint.Port); HtmlMessage message = new HtmlMessage("000000", "已连接到公告服务器!", "", "", 3); new MessageForm(this, message).ShowDialog(); } } catch (Exception exception) { this.log.ErrorFormat("接收登录反馈信息异常:{0}", exception.ToString()); } }
/// <summary> /// /// </summary> /// <param name="Message"></param> protected override void HandleLoginOKMessage(LoginOKMessage Message) { Log("SYS", LOG_CREDENTIALSOK); }
protected override void HandleLoginOKMessage(LoginOKMessage Message) { }
private void method_0() { while (!this.bool_2) { if (this.bool_3) { break; } if ((this.udpClient_0 != null) && ((this.udpClient_0.Available > 5) || this.udpClient_0.Client.Connected)) { byte[] buffer; try { buffer = this.udpClient_0.Receive(ref this.ipendPoint_0); } catch (Exception exception) { this.ilog_0.ErrorFormat("接收数据异常:{0}", exception.ToString()); Thread.Sleep(500); continue; } object obj2 = SerializeTool.Deserialize(buffer); Type type = obj2.GetType(); if (type == typeof(LoginOKMessage)) { LoginOKMessage message = (LoginOKMessage)obj2; this.bool_1 = true; if (message.Code.Equals("0000")) { this.bool_0 = true; } this.ipendPoint_1 = message.EndPoint; this.method_2(message); } else if (type == typeof(HtmlMessage)) { HtmlMessage message2 = (HtmlMessage)obj2; ReceiveOKMessage message3 = new ReceiveOKMessage(this.string_0, this.string_1, message2.Id); buffer = SerializeTool.Serialize(message3); this.udpClient_0.Send(buffer, buffer.Length, this.ipendPoint_0); this.method_1(message2); } else if (type == typeof(StopSrvMessage)) { this.bool_3 = true; StopSrvMessage message4 = (StopSrvMessage)obj2; this.method_3(message4); } else { this.ilog_0.ErrorFormat("接收到的消息格式错误:{0}", type.ToString()); } } else if (!this.bool_0 && (DateTime.Now.Subtract(this.dateTime_0).TotalSeconds > this.MaxConnWaitTime)) { this.dateTime_0 = DateTime.Now.AddYears(1); LoginOKMessage message5 = new LoginOKMessage("Z999", new IPEndPoint(IPAddress.Any, 0)) { Mess = string.Concat(new object[] { "登录超时[", this.ipendPoint_0.Address, ":", this.ipendPoint_0.Port, "]" }) }; this.method_2(message5); } Thread.Sleep(500); } bool flag = this.bool_3; this.bool_3 = false; this.bool_2 = false; if (flag && (this.ReConnectEvent != null)) { this.ReConnectEvent(); } }
/// <summary> /// Handler for a successful verification of login credentials /// </summary> /// <param name="Message"></param> protected override void HandleLoginOKMessage(LoginOKMessage Message) { // nothing really to do in the example client }