# How to send and receive TCP/IP messages

**URL:** <https://discourse.nodered.org/t/how-to-send-and-receive-tcp-ip-messages/23208>\
**Category:** General\
**Created:** [16 March 2020 22:49 UTC](https://discourse.nodered.org/t/how-to-send-and-receive-tcp-ip-messages/23208 "2020-03-16T22:49:02Z")\
**Posts on this page:** 6\
**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:** [16 March 2020 22:49 UTC](https://discourse.nodered.org/t/how-to-send-and-receive-tcp-ip-messages/23208/1 "2020-03-16T22:49:02Z")

</div>

Hello, I haven't used the TCP nodes yet and I was wondering if someone could help me get started.

I want low level control of my media server, which runs Squeezeserver / Logitech Media Server. [Here's the CLI reference](https://github.com/elParaguayo/LMS-CLI-Documentation/blob/master/LMS-CLI.md).

Can you help me get started with a basic flow:

- Let's say I'd like to send `version ?` to 10.1.1.1:9090
- And I'd like to capture the response into a debug node

Maybe I'm just getting stuck with encoding but here's what I've tried so far:

- function node: `msg.payload = "version ?\n"; return msg;`, this is wired to a TCP out node (set to "connected to")
- then a TCP in node wired to debug node

---

<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:** [16 March 2020 22:52 UTC](https://discourse.nodered.org/t/how-to-send-and-receive-tcp-ip-messages/23208/2 "2020-03-16T22:52:25Z")

</div>

If you just want a simple request/response then the tcp-request node is probably a better bet, then followed by the debug.

---

<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:** [16 March 2020 23:00 UTC](https://discourse.nodered.org/t/how-to-send-and-receive-tcp-ip-messages/23208/3 "2020-03-16T23:00:37Z")

</div>

Thanks, that works. I'm receiving hex on the payload in response. Is there a quick basic way to convert each hex byte to a char, e.g. using a node?

EDIT: looks like I can do this to convert buffer to the string:  
`msg.payload = msg.payload.toString()`

---

<div class="post-metadata">

**Author:** ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)\
**Post date:** [17 March 2020 09:35 UTC](https://discourse.nodered.org/t/how-to-send-and-receive-tcp-ip-messages/23208/4 "2020-03-17T09:35:10Z")

</div>

Have a look at this node and you are done.

# node-red-contrib-squeezebox

---

<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:** [17 March 2020 09:57 UTC](https://discourse.nodered.org/t/how-to-send-and-receive-tcp-ip-messages/23208/5 "2020-03-17T09:57:00Z")

</div>

> [@edje11](#):
>
> # node-red-contrib-squeezebox

I've had this contrib for a while, but it doesn't work reliably for me. I get "Error: socket hang up", see below. Anyone else have issues with this contrib?

 ![Clipboard01](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/6/a60b04d3325b3250b67b4d9ce36633f26ecfd199.jpeg)

---

<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:** [31 March 2020 09:57 UTC](https://discourse.nodered.org/t/how-to-send-and-receive-tcp-ip-messages/23208/6 "2020-03-31T09:57:02Z")

</div>

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