/// <summary> /// 응답메시지를 수신한다. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnMessageReceived(object sender, IoSessionMessageEventArgs e) { PostStarMessage starMessage = (PostStarMessage)e.Message; Console.WriteLine(String.Format("{0} : ", starMessage.getSender().nickName)); Console.WriteLine(String.Format("{0}", starMessage.text)); }
/// <summary> /// HandleReceived /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void HandleReceived(Object sender, IoSessionMessageEventArgs e) { var bytes = (byte[])e.Message; if (CallProcessMessage != null) { CallProcessMessage(bytes, HexMessageViewerControl.Direction.In); } _logger.Info(String.Format("Received data {0} Bytes", bytes.Length)); _logger.Trace(String.Format("Received data <= {0} | {1} |", ByteArrayToHexString(bytes), ByteArrayToAsciiString(bytes))); }
private void MessageReceived(object sender, IoSessionMessageEventArgs e) { byte[] data = (byte[])e.Message; PacketDecoderNew decoder = new PacketDecoderNew(data); if (!decoder.Available()) { return; } ClientPacketProcessor.Instance.DelegateHandler(decoder.GetPacket()); decoder.Dispose(); }
private void MessageReceived(object sender, IoSessionMessageEventArgs e) { byte[] data = (byte[])e.Message; PacketDecoderNew decoder = new PacketDecoderNew(data); if (!decoder.Available()) { return; } ClientObject client = (ClientObject)e.Session.GetAttribute(SERVER_KEY); ServerPacketProcessor.Instance.DelegateHandler(client, decoder.GetPacket()); decoder.Dispose(); }
public void onMessageReceived(object sender, IoSessionMessageEventArgs eventArgs) { String json = (String)eventArgs.Message; //System.Console.WriteLine (json); JArray jsonArray = JArray.Parse(json); //System.Console.WriteLine ("jsonArray:" + jsonArray); int commandType = jsonArray [0].Value <int> (); if (commandType == MsgTypeConstant.result) { long requestId = jsonArray [1].ToObject <int> (); CallResultFuture future = (CallResultFuture)metaHolder.requestPool [requestId]; if (future == null) { return; } Dictionary <string, object> details = jsonArray [2].ToObject <Dictionary <string, object> > (); object mapValue; if (details.TryGetValue("Set-Cookie", out mapValue)) { JArray cookieArray = (JArray)mapValue; processSetCookie(cookieArray); } // JArray resultArray = JArray.Parse (jsonArray [3].ToString ()); JArray resultArray = (JArray)jsonArray [3]; future.result = resultArray.First.ToObject(future.resultType); future.done = true; future.isExceptionResult = false; lock (future.monitorLock) { Monitor.PulseAll(future.monitorLock); } return; } if (commandType == MsgTypeConstant.error) { long requestId = jsonArray [2].ToObject <int> (); CallResultFuture future = (CallResultFuture)metaHolder.requestPool [requestId]; metaHolder.requestPool.Remove(requestId); future.done = true; future.isExceptionResult = true; lock (future.monitorLock) { Monitor.PulseAll(future.monitorLock); } return; } // TODO 需要改为线程池处理 }
private void OnMessageReceived(object sender, IoSessionMessageEventArgs e) { String theMessage = (String)e.Message; String[] result = theMessage.Split(new Char[] { ' ' }, 3); String status = result[1]; String theCommand = result[0]; if ("OK".Equals(status)) { if (String.Equals("BROADCAST", theCommand, StringComparison.OrdinalIgnoreCase)) { if (result.Length == 3) { Append(result[2]); } } else if (String.Equals("LOGIN", theCommand, StringComparison.OrdinalIgnoreCase)) { SetState(true); Append("You have joined the chat session."); } else if (String.Equals("QUIT", theCommand, StringComparison.OrdinalIgnoreCase)) { SetState(false); Append("You have left the chat session."); } } else { if (result.Length == 3) { MessageBox.Show(result[2]); } } }
private void MessageSent(object sender, IoSessionMessageEventArgs e) { }