Agnos.Protocol.ClientUtils.WaitReply C# (CSharp) Method

WaitReply() protected method

protected WaitReply ( int seq, int msecs ) : ReplySlot
seq int
msecs int
return ReplySlot
            protected ReplySlot WaitReply(int seq, int msecs)
            {
                ReplySlot slot;
                DateTime tend = infinity;
                int msecs2 = -1;
                if (msecs >= 0) {
                    tend = DateTime.Now + TimeSpan.FromMilliseconds (msecs);
                }

                while (!IsReplyReady (seq)) {
                    if (msecs >= 0) {
                        TimeSpan remaining = tend - DateTime.Now;
                        if (remaining < TimeSpan.Zero) {
                            throw new TimeoutException ("reply did not arrive in time");
                        }
                        msecs2 = remaining.Milliseconds;
                    }
                    ProcessIncoming (msecs2);
                }

                slot = replies[seq];
                replies.Remove (seq);
                return slot;
            }