How to send and receive TCP/IP messages

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.

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

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

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()

1 Like

Have a look at this node and you are done.

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?

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