Sending data with tcp out node

I try to build a very tiny LDAP-service to learn much about LDAP and the structure of ASN.1 coded IP packages. I receive a bind request over the 'tcp in' node and can read all necessary information (user, password, session-id). But now I'm sticking by responding with the bind response. I create the response in the same format as I received the in-message (buffer raw with an array of hex values) and call the 'tcp out' node. Here I selected 'respond to TCP'. And as I can see at wireshark the answer is sent, but only 6 values with 0x00 and not my 14 values from msg.payload.buffer. Can anyone tell me how I can fix it? The help of the node only tells me, that the content of the payload will send out and msg._session is needed for responding, which I can see in debugging.


I'm fairly certain it is mentioned in the built-in help on the side bar, your data needs to be in msg.payload not msg.payload.buffer

Thank you Steve,

this is a mistake at my post. I create it with a function by this code:

var b=Buffer.from([48,13,2,1,msg.msgID,97,7,10,1,0,4,0,4,0])
return msg;


Add a debug node just before the TCP out node & verify what you believe you are sending is correct.

Ps set the debug to show complete message

I did it already and it looks nice for me:


How have you setup the TCP nodes?

Tip: if you knock up a small demo flow that sends sample data using a TCP request node and share that, someone will try it out and help you.

Also, please list version numbers and environment (node version? Node-red version? Docker install? Behind proxy? Part of home assistant? Linux/Mac/windows? Etc)

Node-red is running at my raspberryPI with Raspbian old-stable.

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 5.10.17-v7+ #1403 SMP Mon Feb 22 11:29:51 GMT 2021 armv7l GNU/Linux

Everything runs on my local (W)LAN without proxy etc.. Node-Red is V.1.2.9 (oh, very old, I will search, why itā€˜s not updated - maybe because itā€™s installed from Raspbian DEBsā€¦)
Received data is:


Payload from debug before sending the response is:


I will share the whole flow, stripping it down will create new errors. It's not a high art, it's created with my low knowledge level to learn. Have mercy on me :wink:
flows.json (6.4 KB)


This would definitely be where I start. That is looking out of support

See here: Running on Raspberry Pi : Node-RED

Also, be sure to add --node16 or node18 to the end of the update script - to update node.js at the same time as installing V3.0.2

Now everything is up to date. Node-Red V.3.0.2, node.js 18 and actual Raspbian. And at update time I found out that this was not the problem (but it's fine, that I did this). I looked at the false packet at Wireshark! Also at the old trace, the answer was going out, but I analysed the TCP-ACK-Paket. Blame on me :frowning: One packet later my message is going out but it will not interpret as LDAP package by Wireshark and also not by the client. So I have to find out what's wrong with my packet...


It works so far. I can bind my client (by ignoring a lot of information) successfully. Thanks for your support, Steve!
I'm not a great artist at programming, but if someone needs some input for similar things here is my flow so far:
tinyLDAP.json (6.3 KB)
I'm every time glad by finding such snippets. If someone wants to optimize it - feel so free.
There are some unnecessary things in the flow (e.g. calculating the message ID) but I keep it right now - maybe I need it later.
In conclusion, the main problem was not the version, it was (like mostly) on the human side. I inspected the wrong packet at Wireshark and got confused by this. But so my installation is up to date - what a nice side effect :wink:


1 Like

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