Пример #1
0
 public Task WriteAsync(MPack packet)
 {
     LogWrite(packet);
     var bytes = packet.EncodeToBytes();
     return Client.WriteAsync(bytes);
 }
Пример #2
0
        //private void Error(object sender, ClientEventArgs<Exception> e)
        //{
        //    _buffer.OnError(e.Value);
        //}
        //private void Disconnected(object sender, EventArgs e)
        //{
        //    _buffer.OnCompleted();
        //}
        //private void Recieve(object sender, ClientEventArgs<byte[]> e)
        //{
        //    try
        //    {
        //        var mpack = MPack.ParseFromBytes(e.Value);
        //        LogRead(mpack);
        //        _buffer.OnNext(mpack);
        //    }
        //    catch (Exception ex)
        //    {
        //        _buffer.OnError(ex);
        //    }
        //}

        public void Write(MPack packet)
        {
            LogWrite(packet);
            var bytes = packet.EncodeToBytes();
            Client.Write(bytes);
        }