/// <summary> /// MessageReceived /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void MessageReceived(object sender, Mina.Core.Session.IoSessionMessageEventArgs e) { String str = e.Message.ToString(); // Display content if something comes as plain text ScreenOutput(String.Format("Received {0} from {1}", str, e.Session.RemoteEndPoint)); }
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 Connector_MessageReceived(object sender, Mina.Core.Session.IoSessionMessageEventArgs e) { if (listener != null) { IPacket packet = Packet.GetPacket(e.Message.ToString()); if (packet != null) { listener.HandleMessage(packet); } } }
private void Connector_MessageSent(object sender, Mina.Core.Session.IoSessionMessageEventArgs e) { }
/// <summary> /// HandleReceived /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void HandleReceived(Object sender,IoSessionMessageEventArgs e) { String IncomingStringBuffer = e.Message.ToString(); int IncommingMessageSize = IncomingStringBuffer.Length; _buffer = GetBytes(IncomingStringBuffer); // Send the same date back to the client e.Session.Write(IncomingStringBuffer); CallDUpdateText(String.Format("Geting {0} Bytes Sending {0} back", IncommingMessageSize)); CallDUpdateProgressBar(this, null); }