# TCP Node - message splitting question

**URL:** https://discourse.nodered.org/t/tcp-node-message-splitting-question/57573
**Category:** General
**Created:** [31 January 2022 23:47 UTC](https://discourse.nodered.org/t/tcp-node-message-splitting-question/57573 "2022-01-31T23:47:23Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![hazymat](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hazymat/32/108159_2.png) [@hazymat](https://discourse.nodered.org/u/hazymat)
#### Post date: [31 January 2022 23:47 UTC](https://discourse.nodered.org/t/tcp-node-message-splitting-question/57573/1 "2022-01-31T23:47:23Z")

</div>

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:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/2/72cb1f118dfcaa7ecbb36b4702650e1572f8f480.png)

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?

---

<div class="post-metadata">

### Author: ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)
#### Post date: [1 February 2022 00:49 UTC](https://discourse.nodered.org/t/tcp-node-message-splitting-question/57573/2 "2022-02-01T00:49:34Z")

</div>

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**.

---

<div class="post-metadata">

### Author: ![hazymat](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hazymat/32/108159_2.png) [@hazymat](https://discourse.nodered.org/u/hazymat)
#### Post date: [1 February 2022 00:52 UTC](https://discourse.nodered.org/t/tcp-node-message-splitting-question/57573/3 "2022-02-01T00:52:34Z")

</div>

> [@Sean-McG](#):
>
> larger than 1500 bytes

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

---

<div class="post-metadata">

### Author: ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)
#### Post date: [1 February 2022 00:57 UTC](https://discourse.nodered.org/t/tcp-node-message-splitting-question/57573/4 "2022-02-01T00:57:28Z")

</div>

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

---

<div class="post-metadata">

### Author: ![hazymat](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hazymat/32/108159_2.png) [@hazymat](https://discourse.nodered.org/u/hazymat)
#### Post date: [1 February 2022 01:01 UTC](https://discourse.nodered.org/t/tcp-node-message-splitting-question/57573/5 "2022-02-01T01:01:12Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)
#### Post date: [1 February 2022 01:17 UTC](https://discourse.nodered.org/t/tcp-node-message-splitting-question/57573/6 "2022-02-01T01:17:30Z")

</div>

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 😉

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [1 February 2022 10:27 UTC](https://discourse.nodered.org/t/tcp-node-message-splitting-question/57573/7 "2022-02-01T10:27:09Z")

</div>

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

---

<div class="post-metadata">

### Author: ![hazymat](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hazymat/32/108159_2.png) [@hazymat](https://discourse.nodered.org/u/hazymat)
#### Post date: [1 February 2022 10:44 UTC](https://discourse.nodered.org/t/tcp-node-message-splitting-question/57573/8 "2022-02-01T10:44:20Z")

</div>

Hi, it's:

**OS** : Ubuntu 20.04.2 LTS  
**NodeRED version** : 2.0.4

Here is how I have configured the TCP node:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/b/1ba9a49330935c4fd8a908a01390632f84f7f555.png)

---

<div class="post-metadata">

### Author: ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)
#### Post date: [1 February 2022 17:35 UTC](https://discourse.nodered.org/t/tcp-node-message-splitting-question/57573/9 "2022-02-01T17:35:39Z")

</div>

Have you tried output single buffer ?

---

<div class="post-metadata">

### Author: ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)
#### Post date: [5 February 2022 02:18 UTC](https://discourse.nodered.org/t/tcp-node-message-splitting-question/57573/10 "2022-02-05T02:18:33Z")

</div>

@hazymat Did you get anywhere with this ?

---

<div class="post-metadata">

### Author: ![hazymat](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hazymat/32/108159_2.png) [@hazymat](https://discourse.nodered.org/u/hazymat)
#### Post date: [6 February 2022 11:57 UTC](https://discourse.nodered.org/t/tcp-node-message-splitting-question/57573/11 "2022-02-06T11:57:20Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [7 April 2022 11:57 UTC](https://discourse.nodered.org/t/tcp-node-message-splitting-question/57573/12 "2022-04-07T11:57:30Z")

</div>

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