# Changing Host IP address modbusTcp

**URL:** https://discourse.nodered.org/t/changing-host-ip-address-modbustcp/14678
**Category:** General
**Created:** [23 August 2019 03:32 UTC](https://discourse.nodered.org/t/changing-host-ip-address-modbustcp/14678 "2019-08-23T03:32:34Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![ajaymn](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@ajaymn](https://discourse.nodered.org/u/ajaymn)
#### Post date: [23 August 2019 03:32 UTC](https://discourse.nodered.org/t/changing-host-ip-address-modbustcp/14678/1 "2019-08-23T03:32:34Z")

</div>

Hello,

I have implemented a Modbus TCP Master application using Node-Red. I am able to establish the read properly if I go to the flow settings and enter the Host IP address to the Server settings page. However now I want to have the user enter the Host IP address using a text box. I am referring to these links:

> **[node-red-contrib-modbustcp](https://flows.nodered.org/node/node-red-contrib-modbustcp)**
>
> Node-RED nodes for communicating with a MODBUS TCP Server.

  

> **[Argonne-National-Laboratory/node-red-contrib-modbustcp](https://github.com/Argonne-National-Laboratory/node-red-contrib-modbustcp)**
>
> Node-Red nodes for communicating with a Modbus TCP server - Argonne-National-Laboratory/node-red-contrib-modbustcp

and I am able to get the IP address from the text box and send it to the modbustcp node. However every time the node tries to reconnect it keeps using the IP address that has been set in the flow settings of the node. Now there are two possibilities that could be messing up what I am doing -

1. The variable that I am passing to the modbustcp node is incorrect
2. Whenever the node - modbustcp tries to reconnect it keeps using the default values, so maybe I have to restart it by letting it know that it has to use the values received.

As far as Point 1 goes I have tried : node.host = in msb.payload OR msg - Both do not seem to work or rather it could be point 2 now.  
2. Maybe I will have to restart the node programmatically for it to establish a socket on the new IP address.  
I am trying it for one day and could not get to it. Tried looking for help online but I did not find anyone who ran into a similar issue.  
Has anyone changed the IP address of the host programmatically while using the modbustcp node.  
In fact I tried changing the poll rate dynamically but that also did not work. Not sure what is going on.  
Any help will be appreciated.  
Thanks  
AJ

---

<div class="post-metadata">

### Author: ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)
#### Post date: [23 August 2019 05:19 UTC](https://discourse.nodered.org/t/changing-host-ip-address-modbustcp/14678/2 "2019-08-23T05:19:03Z")

</div>

I don't use the node, but if the API defined in the ReadMe doesn't include IP address, what makes you think you can do it?

In fact there is even an issue opened on the github page that you linked to that says that's it isn't possible today.

> <https://github.com/Argonne-National-Laboratory/node-red-contrib-modbustcp/issues/28>

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [23 August 2019 06:51 UTC](https://discourse.nodered.org/t/changing-host-ip-address-modbustcp/14678/3 "2019-08-23T06:51:07Z")

</div>

You could fork it, fix it & do a pull request?

The beauty of open source.

Even if the author doesn't accept your PR you can use your fork quite easily....  
`npm install mygithubname/node-red-contrib-modbustcp`

---

<div class="post-metadata">

### Author: ![ajaymn](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@ajaymn](https://discourse.nodered.org/u/ajaymn)
#### Post date: [23 August 2019 06:59 UTC](https://discourse.nodered.org/t/changing-host-ip-address-modbustcp/14678/4 "2019-08-23T06:59:23Z")

</div>

Thanks @Steve-Mcl and @ukmoose

So the feature is not available. Thanks @ukmoose for pointing to the issue. Looks like I will have to fork it and fix it. Will give it a shot.

Thanks for your help

---

<div class="post-metadata">

### Author: ![vlory73](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vlory73/32/20045_2.png) [@vlory73](https://discourse.nodered.org/u/vlory73)
#### Post date: [22 March 2020 09:51 UTC](https://discourse.nodered.org/t/changing-host-ip-address-modbustcp/14678/5 "2020-03-22T09:51:54Z")

</div>

> [@ajaymn](#):
>
> Looks like I will have to fork it and fix it. Will give it a shot.

@ajaymn,  
Did you get to make it work? I am using another package (node-red-contrib-modbus), but if you got it working, I would gladly try it out as I'm facing the same issue.
