# Tcp request data length

**URL:** <https://discourse.nodered.org/t/tcp-request-data-length/78866>\
**Category:** General\
**Created:** [1 June 2023 12:51 UTC](https://discourse.nodered.org/t/tcp-request-data-length/78866 "2023-06-01T12:51:36Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nadhir](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@Nadhir](https://discourse.nodered.org/u/Nadhir)\
**Post date:** [1 June 2023 12:51 UTC](https://discourse.nodered.org/t/tcp-request-data-length/78866/1 "2023-06-01T12:51:36Z")

</div>

I am using TCP request node to communicate with an instrument teh problem is the node only retreives part of of the recieved data (my data is approximatly 2800 bytes ) , when I use an other software it works fine and all the message is received , I have tried incresing timout but the same behaviour occures , my question is what is the size of the recieve buffer of tcp request node and how to increse it in order to retreive all my data.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [1 June 2023 13:06 UTC](https://discourse.nodered.org/t/tcp-request-data-length/78866/2 "2023-06-01T13:06:18Z")

</div>

Are you sure the TCP node is missing data or could it be the debug node's limit?

To be sure you can divert debug output to the log file. (Can't remember exactly what it's called) That should show the whole payload.

---

<div class="post-metadata">

**Author:** ![Nadhir](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@Nadhir](https://discourse.nodered.org/u/Nadhir)\
**Post date:** [1 June 2023 13:24 UTC](https://discourse.nodered.org/t/tcp-request-data-length/78866/3 "2023-06-01T13:24:59Z")

</div>

I have tried logging the recieved data to a text file but without any success the , it only logs the amount of data displayed in the debug window

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [1 June 2023 14:39 UTC](https://discourse.nodered.org/t/tcp-request-data-length/78866/4 "2023-06-01T14:39:48Z")

</div>

Is it that messages are sometimes split across multiple messages?

---

<div class="post-metadata">

**Author:** ![Nadhir](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@Nadhir](https://discourse.nodered.org/u/Nadhir)\
**Post date:** [1 June 2023 16:29 UTC](https://discourse.nodered.org/t/tcp-request-data-length/78866/5 "2023-06-01T16:29:48Z")

</div>

I have tried sniffing data packets using wireshark with TCP RESQUEST NODE what I receive is what I get from sniffing  
using an other software like putty or docklight works fine and all data is retreived  
seems that there is a problem with TCP node with large data messages

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [1 June 2023 16:50 UTC](https://discourse.nodered.org/t/tcp-request-data-length/78866/6 "2023-06-01T16:50:54Z")

</div>

You haven't answered my question.

---

<div class="post-metadata">

**Author:** ![Nadhir](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@Nadhir](https://discourse.nodered.org/u/Nadhir)\
**Post date:** [2 June 2023 08:09 UTC](https://discourse.nodered.org/t/tcp-request-data-length/78866/7 "2023-06-02T08:09:58Z")

</div>

**Yes the message contain several CR , LF caracters it is composed of 8 messages , this is the message using docklight :**

01/06/2023 17:20:09.102 [TX] - FE 7956

01/06/2023 17:20:09.157 [RX] -   
................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................OK  
  
Resetting...ÿ  
rst type: 0xaService components: 17, DB size: 370 bytes.  
Cosem objects: 488, DB size: 4402 bytes, 2 records.  
Total DB size: 4772 bytes.  
  
Welcome on the CLI monitor  
Type - at any time to go back to root menu  
(Press ? for help or ? for help on a specific command)

**and this is the message using node red tcp request :**

..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

**But other shorter messages works fine with node red , here a similar shorter message with an other instrument :**

................................................................................................................................................................................................................................................................OK

Resetting...

Welcome on the CLI monitor

Type - at any time to go back to root menu

(Press ? for help or ? for help on a specific command)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 June 2023 08:46 UTC](https://discourse.nodered.org/t/tcp-request-data-length/78866/8 "2023-06-02T08:46:19Z")

</div>

What I meant was, in the failing case does all the data arrive correctly eventually, but it is split over two or more messages from the TCP node?

---

<div class="post-metadata">

**Author:** ![Nadhir](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@Nadhir](https://discourse.nodered.org/u/Nadhir)\
**Post date:** [2 June 2023 09:01 UTC](https://discourse.nodered.org/t/tcp-request-data-length/78866/9 "2023-06-02T09:01:18Z")

</div>

No the data does not arrive correctly only part of it arrives as described in the previous reply and it is a one message reply

---

<div class="post-metadata">

**Author:** ![Nadhir](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@Nadhir](https://discourse.nodered.org/u/Nadhir)\
**Post date:** [2 June 2023 11:26 UTC](https://discourse.nodered.org/t/tcp-request-data-length/78866/10 "2023-06-02T11:26:14Z")

</div>

When I keep connection open and logs the output to a text file I receive all the message , but this is a problem as I am sending multiple commands and I am using the same host and port again in my flow , so I need the connection to close after a certain timeout

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 June 2023 12:02 UTC](https://discourse.nodered.org/t/tcp-request-data-length/78866/12 "2023-06-02T12:02:53Z")

</div>

I deleted my previous post as it crossed with yours.

So the data is coming back, but in multiple chunks. That is normal for TCP, it has no direct knowledge of records, only bytes. How have you configured the request node?

Try setting it to return after a timeout longer that you ever expect it to take (but less than your repeat interval obviously).

---

<div class="post-metadata">

**Author:** ![Nadhir](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@Nadhir](https://discourse.nodered.org/u/Nadhir)\
**Post date:** [2 June 2023 14:51 UTC](https://discourse.nodered.org/t/tcp-request-data-length/78866/13 "2023-06-02T14:51:29Z")

</div>

![TCP_TIMEOUT](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/6/060a70c8f4734394c88502ba08f059c5343fe074.png)  
timout is 45 s , when msg is logged in a text file , it works well for now but when displayed in debug or in a global variable it stores only part of it . what is the maximum size of a global variable in node red ?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 June 2023 15:04 UTC](https://discourse.nodered.org/t/tcp-request-data-length/78866/14 "2023-06-02T15:04:02Z")

</div>

There is no maximum size.

I think perhaps there is a simple reason. Do you mean that the debug node shows a truncated output, but the message itself is all there? That is just the debug node showing only a portion of the data, to save overloading the browser.

---

<div class="post-metadata">

**Author:** ![Nadhir](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@Nadhir](https://discourse.nodered.org/u/Nadhir)\
**Post date:** [2 June 2023 15:04 UTC](https://discourse.nodered.org/t/tcp-request-data-length/78866/15 "2023-06-02T15:04:31Z")

</div>

I changed the debugMaxLength: 1000, in the settings.js file and it works fine

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 June 2023 15:26 UTC](https://discourse.nodered.org/t/tcp-request-data-length/78866/16 "2023-06-02T15:26:03Z")

</div>

It was working fine before, it was only the debug display that was truncated.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [2 June 2023 15:26 UTC](https://discourse.nodered.org/t/tcp-request-data-length/78866/17 "2023-06-02T15:26:47Z")

</div>

That doesn't agree with what you said yesterday when I suggested you check the debug output.

There must have been some other change which resolved it.

---

<div class="post-metadata">

**Author:** ![Nadhir](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@Nadhir](https://discourse.nodered.org/u/Nadhir)\
**Post date:** [2 June 2023 16:23 UTC](https://discourse.nodered.org/t/tcp-request-data-length/78866/18 "2023-06-02T16:23:17Z")

</div>

yes I concur yesterday I was only receiving part of the msg , I did not change any thing accept trying to update node red

---

<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:** [1 August 2023 16:23 UTC](https://discourse.nodered.org/t/tcp-request-data-length/78866/19 "2023-08-01T16:23:30Z")

</div>

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