# Need some basic example how tcp-client is setup

**URL:** <https://discourse.nodered.org/t/need-some-basic-example-how-tcp-client-is-setup/33170>\
**Category:** General\
**Created:** [22 September 2020 08:38 UTC](https://discourse.nodered.org/t/need-some-basic-example-how-tcp-client-is-setup/33170 "2020-09-22T08:38:45Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![JosephDe](https://avatars.discourse-cdn.com/v4/letter/j/e19adc/32.png) [@JosephDe](https://discourse.nodered.org/u/JosephDe)\
**Post date:** [22 September 2020 08:38 UTC](https://discourse.nodered.org/t/need-some-basic-example-how-tcp-client-is-setup/33170/1 "2020-09-22T08:38:45Z")

</div>

Hi! does anyone knows how to make tcp-client setup to listen to a specific address and port. My apology if this may be simple but I don't figured it out yet how to make it work. I got the module from this link [https://flows.nodered.org/node/node-red-contrib-tcp-client](https://flows.nodered.org/node/node-red-contrib-tcp-client). I also tried the **tcp request** and works fine (Server: localhost Port: 7811) I can send string and receive message, but I wanted to try tcp-client.

Thanks for the time,  
joe

 ![UploadIt](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/5/157b89cd3363a77144f07721e6125078afc7e16e.png)

---

<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:** [22 September 2020 17:24 UTC](https://discourse.nodered.org/t/need-some-basic-example-how-tcp-client-is-setup/33170/2 "2020-09-22T17:24:18Z")

</div>

Do you need to create dynamic ports? If not you can use the core tcp-in node to create a listener. The tcp-request node creates an outbound connection.

---

<div class="post-metadata">

**Author:** ![JosephDe](https://avatars.discourse-cdn.com/v4/letter/j/e19adc/32.png) [@JosephDe](https://discourse.nodered.org/u/JosephDe)\
**Post date:** [23 September 2020 03:08 UTC](https://discourse.nodered.org/t/need-some-basic-example-how-tcp-client-is-setup/33170/3 "2020-09-23T03:08:27Z")

</div>

I realized that the **Tcp Request** fits to my needs. The reason I tried to focus on the **Tcp client** , I thought it would be easy to modify it later, unlike the Tcp Request which included in the node red folder with the other category nodes(network,functions, storage & etc). Is it possible to have Tcp request only and cloned it then modify to my own need? I'm still new to node red(but I was able to do the lower-case example) and really appreciate any guide that will help me continue my application in mind.

Thank you,  
joe

---

<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:** [23 September 2020 09:37 UTC](https://discourse.nodered.org/t/need-some-basic-example-how-tcp-client-is-setup/33170/4 "2020-09-23T09:37:27Z")

</div>

> [@JosephDe](#):
>
> Is it possible to have Tcp request only and cloned it then modify to my own need?

If you are feeling the need to amend a node, there is a good chance that you haven't thought through the opportunities that Node-RED brings and the slightly different way you may need to think about things.

It would be better if you explained what it is that you want to achieve.

---

<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:** [23 September 2020 09:40 UTC](https://discourse.nodered.org/t/need-some-basic-example-how-tcp-client-is-setup/33170/5 "2020-09-23T09:40:12Z")

</div>

The core nodes source is in here [https://github.com/node-red/node-red/tree/master/packages/node\_modules/%40node-red/nodes/core/network](https://github.com/node-red/node-red/tree/master/packages/node_modules/%40node-red/nodes/core/network)  
the 32-tcpin files contain all three tcp nodes so you can take it apart as you wish (and rename of course)

---

<div class="post-metadata">

**Author:** ![JosephDe](https://avatars.discourse-cdn.com/v4/letter/j/e19adc/32.png) [@JosephDe](https://discourse.nodered.org/u/JosephDe)\
**Post date:** [23 September 2020 13:07 UTC](https://discourse.nodered.org/t/need-some-basic-example-how-tcp-client-is-setup/33170/6 "2020-09-23T13:07:40Z")

</div>

Thank you for helping me out...I will post later if I have other questions.

Regards & more power,  
Joe

---

<div class="post-metadata">

**Author:** ![JosephDe](https://avatars.discourse-cdn.com/v4/letter/j/e19adc/32.png) [@JosephDe](https://discourse.nodered.org/u/JosephDe)\
**Post date:** [23 September 2020 13:14 UTC](https://discourse.nodered.org/t/need-some-basic-example-how-tcp-client-is-setup/33170/7 "2020-09-23T13:14:16Z")

</div>

I have a device that I would to control and I simply want my customised node functions same as tcp request node but wanted also to add or change to fit my need.

---

<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:** [23 September 2020 20:59 UTC](https://discourse.nodered.org/t/need-some-basic-example-how-tcp-client-is-setup/33170/8 "2020-09-23T20:59:18Z")

</div>

OK, that is more reasonable for sure.

---

<div class="post-metadata">

**Author:** ![JosephDe](https://avatars.discourse-cdn.com/v4/letter/j/e19adc/32.png) [@JosephDe](https://discourse.nodered.org/u/JosephDe)\
**Post date:** [24 September 2020 16:51 UTC](https://discourse.nodered.org/t/need-some-basic-example-how-tcp-client-is-setup/33170/9 "2020-09-24T16:51:15Z")

</div>

Hi, thank you for creating and sharing these node modules. I'm still new in javascript so I'm still stuck in putting it together. So far here is what I did.

1. Create a folder to place the _js_, _html_ and _jason_ file.
2. Copy codes from 31-tcpin.js (function TcpGet part only).
3. Copy codes from 31-tcpin.html (in the part tcp request).
4. I created the jason file but not sure if I made it right.

When I open the terminal(on raspberry pi) I did the ff. commands  
a.) cd to my folder(node-red-contrib-tcp-client)  
b.) sudo npm install  
c.) cd ~/.node-red  
d.) sudo npm link node-red-contrib-tcp-client  
Issuing the commands above did not show any errors but it also did not work. Can you help me try to identify what I'm missing? I also uploads the files I'm working on below.  
[package.json](https://discourse.nodered.org/uploads/short-url/hvx6PuYNbLF7wwHLlThV8rJljC3.json) (2.7 KB)  
[tcp-client.html.txt](https://discourse.nodered.org/uploads/short-url/sM5yboHv4kEVFxlkNNvsq4G6B61.txt) (8.4 KB) [tcp-client.js.txt](https://discourse.nodered.org/uploads/short-url/9AoK6hYXktXGxGfIdFtLKpJAWWc.txt) (12.7 KB)

Thank you for the time,  
Joe

---

<div class="post-metadata">

**Author:** ![JosephDe](https://avatars.discourse-cdn.com/v4/letter/j/e19adc/32.png) [@JosephDe](https://discourse.nodered.org/u/JosephDe)\
**Post date:** [25 September 2020 02:32 UTC](https://discourse.nodered.org/t/need-some-basic-example-how-tcp-client-is-setup/33170/10 "2020-09-25T02:32:28Z")

</div>

No showing of node in the palette and the category I created. There must be conflicting between the existing node-red-contrib-tcp-client I have installed earlier. I will try to remove it...and see the result.

---

<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:** [25 September 2020 08:22 UTC](https://discourse.nodered.org/t/need-some-basic-example-how-tcp-client-is-setup/33170/11 "2020-09-25T08:22:42Z")

</div>

Give your new one a different name.

---

<div class="post-metadata">

**Author:** ![JosephDe](https://avatars.discourse-cdn.com/v4/letter/j/e19adc/32.png) [@JosephDe](https://discourse.nodered.org/u/JosephDe)\
**Post date:** [25 September 2020 08:32 UTC](https://discourse.nodered.org/t/need-some-basic-example-how-tcp-client-is-setup/33170/12 "2020-09-25T08:32:51Z")

</div>

Hi!, just want to ask if I need to change the name of the html and js file?  
`"<script type="text/x-red" data-template-name="tcp-client">"` ..in the html file(tcp-client), this should be change too?

---

<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:** [25 September 2020 08:59 UTC](https://discourse.nodered.org/t/need-some-basic-example-how-tcp-client-is-setup/33170/13 "2020-09-25T08:59:05Z")

</div>

I don't know if it is essential, probably not, but I always name them according to the node for consistency.

---

<div class="post-metadata">

**Author:** ![JosephDe](https://avatars.discourse-cdn.com/v4/letter/j/e19adc/32.png) [@JosephDe](https://discourse.nodered.org/u/JosephDe)\
**Post date:** [25 September 2020 09:00 UTC](https://discourse.nodered.org/t/need-some-basic-example-how-tcp-client-is-setup/33170/14 "2020-09-25T09:00:14Z")

</div>

okay... I will try it. Thanks for the suggestion.

---

<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:** [24 November 2020 09:00 UTC](https://discourse.nodered.org/t/need-some-basic-example-how-tcp-client-is-setup/33170/15 "2020-11-24T09:00:15Z")

</div>

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