Esempio n. 1
0
 public AsyncRequest(Message request, TimeSpan timeout)
 {
     this.Request = request;
     this.WaitHandle = new ManualResetEvent(request.ServiceType != ServiceType.RequestResponse);
     this.ResponseCallback = new MessageReceivedHandler(this.ResponseReceived);
     this.TimeSpan = timeout;
     this.Start = CurrentTime.Now;
     this.Id = Guid.NewGuid().ToString();
 }
Esempio n. 2
0
 public static IdentifiedMessage FromStream(Stream source)
 {
     IdentifiedMessage msg = null;
     byte msgType = (byte)source.ReadByte();
     msgType = (byte)(msgType >> 1);
     if (msgType == 1)
     {
         msg = new Message();
     }
     msg.Deserialize(source);
     return msg;
 }
Esempio n. 3
0
 private void ResponseReceived(object sender, Message message)
 {
     this.Response = message;
     this.WaitHandle.Set();
 }