public IAsyncResult BeginReadMessage(AsyncCallback callback, object state) { ReadMessageAsyncResult ar = new ReadMessageAsyncResult(callback, state); UThreadPool.RunCall(AsyncReadMessage, ar); return(ar); }
private void processMessage(PmlElement Message) { if (Message is PmlString) { String cmd = Message.ToString(); if (cmd == "PING") { _WriteMessage("PONG"); } else if (cmd == "PONG") { } } else if (Message is PmlDictionary) { String cmd = Message.GetChild("CMD").ToString(); if (cmd == "SES") { processSessionMessage(Message); } else if (cmd == "RPL") { UInt32 SID = Message.GetChild("SID").ToUInt32(); CSyncRequest SRequest; lock (_invocations) { if (!_invocations.TryGetValue(SID, out SRequest)) { SRequest = null; } _invocations.Remove(SID); } if (SRequest != null) { SRequest.Completed((PmlDictionary)Message); } } else if (cmd == "REQ" || cmd == "MSG") { UThreadPool.RunCall(processCall, Message); } } }