# RAW Command via TCP

**URL:** <https://discourse.nodered.org/t/raw-command-via-tcp/40489>\
**Category:** General\
**Created:** [6 February 2021 13:08 UTC](https://discourse.nodered.org/t/raw-command-via-tcp/40489 "2021-02-06T13:08:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![martinschki](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/martinschki/32/737_2.png) [@martinschki](https://discourse.nodered.org/u/martinschki)\
**Post date:** [6 February 2021 13:08 UTC](https://discourse.nodered.org/t/raw-command-via-tcp/40489/1 "2021-02-06T13:08:22Z")

</div>

Hi All,

I need to send RAW commands via TCP to a device.  
The example would be: socat stdio tcp:192.168.1.1:22 and then the command ended by CRLF

using the function  
`msg.payload = "GetCommand 1234\r\n"`  
doesn't work.  
I'm using the TCP request Node.

In addition, is there an easy way to remove the CRLF from the response? It is being sent at the beginning and at the end of every answer.

Thank you

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [6 February 2021 13:48 UTC](https://discourse.nodered.org/t/raw-command-via-tcp/40489/2 "2021-02-06T13:48:59Z")

</div>

> [@martinschki](#):
>
> In addition, is there an easy way to remove the CRLF from the response? It is being sent at the beginning and at the end of every answer.

Use a trim function to do that. Either in a function node or a change node using JSONata

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

You could also use a change node with a regex.

---

<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 2021 13:49 UTC](https://discourse.nodered.org/t/raw-command-via-tcp/40489/3 "2021-04-07T13:49:27Z")

</div>

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