示例#1
0
        /// <summary>COM_PING, check if the server is alive.</summary>
        public OkPacket Ping()
        {
            using (var stream = client.GetStream())
            {
                var readWriteBuffer = InternalMemoryPool.GetBuffer();
                var writer          = PacketWriter.Create(readWriteBuffer);
                ProtocolWriter.WritePing(ref writer);

                var reader = SyncWriteAndRead(ref writer, 0, stream);

                var response = ProtocolReader.ReadResponsePacket(ref reader);
                response.ThrowIfError();

                return((OkPacket)response);
            }
        }