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

Ping() public method

public Ping ( string payload, int msecs ) : int
payload string
msecs int
return int
            public int Ping(string payload, int msecs)
            {
                DateTime t0 = DateTime.Now;
                int seq = getSeq ();
                transport.BeginWrite (seq);
                Packers.Int8.pack (CMD_PING, transport);
                Packers.Str.pack (payload, transport);
                transport.EndWrite ();
                replies[seq] = new ReplySlot (Packers.Str);
                string reply;
                try {
                    reply = (string)GetReply (seq, msecs);
                } catch (TimeoutException ex) {
                    DiscardReply (seq);
                    throw ex;
                }
                TimeSpan dt = DateTime.Now - t0;
                if (reply != payload) {
                    throw new ProtocolError ("reply does not match payload!");
                }
                return dt.Milliseconds;
            }