Azure / azure-iot-protocol-gateway

Azure IoT protocol gateway enables protocol translation for Azure IoT Hub
Other
225 stars 151 forks source link

ChannelRead in ChannelHandlerAdapter is not reading the entire message from the channel. Data packet is being chunked out to 2 packets #194

Open SwethaEmerson opened 2 years ago

SwethaEmerson commented 2 years ago

I'm using DotNetty.Transport.Channels.ChannelHandlerAdapter to read the incoming packets from the cloud gateway. channelRead() of ChannelHandler is reading and returning the packets if the size of the packet is less than 400 bytes. When I try to push a data packet of size 4000 from the device to the gateway, the packet is being chunked out to 2 packets with size, 1024 and 2976. If I try to push the same packet from the device again, gateway is able to read the entire packet in this attempt(2nd time).

I'm using ReadableBytes(from IByteBuffer) as the size of the packet to read it from the channel.The readable bytes value is set to 1024 in the above mentioned case.

I have tried different options like using MqttDecoder but it did not help.