public void Send(CoapMessage message)
 {
     if (channel != null && channel.Open)
     {
         if (_clientProtocol != null)
         {
             IByteBuffer buffer = CoapParser.encode(message);
             _clientProtocol.sendPacket(buffer);
         }
         else
         {
             channel.WriteAndFlushAsync(message);
         }
     }
 }
Esempio n. 2
0
        protected override void Encode(IChannelHandlerContext context, CoapMessage message, List <object> output)
        {
            IByteBuffer buffer = CoapParser.encode(message);

            output.Add(new DatagramPacket(buffer, _channel.LocalAddress, _channel.RemoteAddress));
        }