TCP Node - message splitting question

I am sending 40,002 byte TCP packet from a microcontroller and reading it into Node-RED from the TCP node.

I'm reading the contents of the buffer using the debug node.

  1. The TCP packet seems to end up as two messages in Node-RED. Here you can see the sizes:

Is there any rhyme or reason as to why they are split or in what proportion?

  1. Is there a good way to detect disconnections? If I reset the microcontroller, it seems to show in the node status that one connection exists. Then when I restart the MCU it sometimes sees two connections, and sometimes seems to disconnect the first one. Any ideas why that may be?

From Google -

Ethernet traffic moves in units called frames. The maximum size of frames is called the Maximum Transmission Unit (MTU). When a network device gets a frame that is larger than its MTU, the data is either fragmented into smaller frames, or dropped. ... An Ethernet packet larger than 1500 bytes is called a jumbo frame .

Thanks, but how does this explain the message segmentation shown above?

Fair point, does it always split at the same sizes ?

It does seem to split into the same buffer sizes, when the same number of bytes are sent.

However if I send different numbers of bytes in the first place, the message splitting can be different.

I guess you can join the two payload together, but as to why it splits as it does I'm not sure.
Maybe there is a setting in NR that needs tweaking ?
You will need to wait for the smart people to help out :wink:

How do you have the tcp in node configured ? Which version of Node-RED ? Which OS are you running on ?

Hi, it's:

OS: Ubuntu 20.04.2 LTS
NodeRED version: 2.0.4

Here is how I have configured the TCP node:

Have you tried output single buffer ?

@hazymat Did you get anywhere with this ?

I tried setting output to single buffer, but it doesn't return anything. (Client connects okay, but no packets are shown on debug output)...

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.