2

I have this parameters set for Netty in one API I need to send data to via TCP (SSL enabled).

LengthFieldBasedFrameDecoder(1048576, 0, 4, 0, 4))

Parameters:

  • maxFrameLength - the maximum length of the frame. If the length of the frame is greater than this value, TooLongFrameException will be thrown.
  • lengthFieldOffset - the offset of the length field.
  • lengthFieldLength - the length of the length field.
  • lengthAdjustment - the compensation value to add to the value of the length field.
  • initialBytesToStrip - the number of first bytes to strip out from the decoded frame.

I have message (string) that I need to send and they are being rejected because of: error message "Adjusted frame length exceeds 1048576: 2065855613"

So the question is, how can I set a frame for the message in ruby to meet Netty's parameters?

trickymuffin
  • 143
  • 2
  • 7

1 Answers1

1

Your problem is you aren't specifying the frame field length in your message. The decimal number 2065855613 is {"t} in ASCII, which looks like the first few bytes of the start of a JSON message.

The solution then is to make sure you append a 4 byte message length to the beginning of the message (not including the length of the length field itself).

Michael Choi
  • 200
  • 1
  • 8