# Raspberry pi not connected with internet than node red should store data in device once it reconnected to the internet it should send to the cloud using tcpip

**URL:** <https://discourse.nodered.org/t/raspberry-pi-not-connected-with-internet-than-node-red-should-store-data-in-device-once-it-reconnected-to-the-internet-it-should-send-to-the-cloud-using-tcpip/67746>\
**Category:** Share Your Projects\
**Tags:** http-request, database, modbus, function-node\
**Created:** [15 September 2022 12:13 UTC](https://discourse.nodered.org/t/raspberry-pi-not-connected-with-internet-than-node-red-should-store-data-in-device-once-it-reconnected-to-the-internet-it-should-send-to-the-cloud-using-tcpip/67746 "2022-09-15T12:13:32Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![t4amit](https://avatars.discourse-cdn.com/v4/letter/t/47e85d/32.png) [@t4amit](https://discourse.nodered.org/u/t4amit)\
**Post date:** [15 September 2022 12:13 UTC](https://discourse.nodered.org/t/raspberry-pi-not-connected-with-internet-than-node-red-should-store-data-in-device-once-it-reconnected-to-the-internet-it-should-send-to-the-cloud-using-tcpip/67746/1 "2022-09-15T12:13:32Z")

</div>

Dear Sir,

i Just want to send simple data from Raspberry pi using node red tcp/ip communication, when raspberry pi is connected with internet it should send the data ,and when the raspberry pi is not connected with internet it should store data & once it reconnected it should send stored data please help.  
please help sir ,this project is my life please tell is that possible or not, please.

Thanks & Regards,  
Amit

---

<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:** [15 September 2022 15:26 UTC](https://discourse.nodered.org/t/raspberry-pi-not-connected-with-internet-than-node-red-should-store-data-in-device-once-it-reconnected-to-the-internet-it-should-send-to-the-cloud-using-tcpip/67746/2 "2022-09-15T15:26:42Z")

</div>

Yes, that is possible. Which bits do you not know how to do?

For the online/offline part, search on the node red flows site for guaranteed delivery and you will find a flow that does that.

---

<div class="post-metadata">

**Author:** ![t4amit](https://avatars.discourse-cdn.com/v4/letter/t/47e85d/32.png) [@t4amit](https://discourse.nodered.org/u/t4amit)\
**Post date:** [16 September 2022 03:33 UTC](https://discourse.nodered.org/t/raspberry-pi-not-connected-with-internet-than-node-red-should-store-data-in-device-once-it-reconnected-to-the-internet-it-should-send-to-the-cloud-using-tcpip/67746/3 "2022-09-16T03:33:30Z")

</div>

[  
{  
"id": "51c6499e43ce6873",  
"type": "tab",  
"label": "Flow 1",  
"disabled": false,  
"info": "",  
"env":   
},  
{  
"id": "224cb7d30bd7fb8e",  
"type": "inject",  
"z": "51c6499e43ce6873",  
"name": "Data",  
"props": [  
{  
"p": "payload"  
},  
{  
"p": "topic",  
"vt": "str"  
}  
],  
"repeat": "3",  
"crontab": "",  
"once": false,  
"onceDelay": 0.1,  
"topic": "",  
"payload": "5",  
"payloadType": "num",  
"x": 230,  
"y": 180,  
"wires": [  
[  
"065257d2bdae4eef",  
"109815f67a129df7"  
]  
]  
},  
{  
"id": "109815f67a129df7",  
"type": "debug",  
"z": "51c6499e43ce6873",  
"name": "debug 1",  
"active": true,  
"tosidebar": true,  
"console": false,  
"tostatus": false,  
"complete": "false",  
"statusVal": "",  
"statusType": "auto",  
"x": 560,  
"y": 280,  
"wires":   
},  
{  
"id": "065257d2bdae4eef",  
"type": "tcp out",  
"z": "51c6499e43ce6873",  
"name": "",  
"host": "192.145.1.",  
"port": "3306",  
"beserver": "client",  
"base64": false,  
"end": true,  
"tls": "",  
"x": 580,  
"y": 180,  
"wires":   
}  
]

---

<div class="post-metadata">

**Author:** ![t4amit](https://avatars.discourse-cdn.com/v4/letter/t/47e85d/32.png) [@t4amit](https://discourse.nodered.org/u/t4amit)\
**Post date:** [16 September 2022 03:37 UTC](https://discourse.nodered.org/t/raspberry-pi-not-connected-with-internet-than-node-red-should-store-data-in-device-once-it-reconnected-to-the-internet-it-should-send-to-the-cloud-using-tcpip/67746/4 "2022-09-16T03:37:05Z")

</div>

this is my code flow.

[  
{  
"id": "51c6499e43ce6873",  
"type": "tab",  
"label": "Flow 1",  
"disabled": false,  
"info": "",  
"env":   
},  
{  
"id": "224cb7d30bd7fb8e",  
"type": "inject",  
"z": "51c6499e43ce6873",  
"name": "Data",  
"props": [  
{  
"p": "payload"  
},  
{  
"p": "topic",  
"vt": "str"  
}  
],  
"repeat": "3",  
"crontab": "",  
"once": false,  
"onceDelay": 0.1,  
"topic": "",  
"payload": "5",  
"payloadType": "num",  
"x": 230,  
"y": 180,  
"wires": [  
[  
"065257d2bdae4eef",  
"109815f67a129df7"  
]  
]  
},  
{  
"id": "109815f67a129df7",  
"type": "debug",  
"z": "51c6499e43ce6873",  
"name": "debug 1",  
"active": true,  
"tosidebar": true,  
"console": false,  
"tostatus": false,  
"complete": "false",  
"statusVal": "",  
"statusType": "auto",  
"x": 560,  
"y": 280,  
"wires":   
},  
{  
"id": "065257d2bdae4eef",  
"type": "tcp out",  
"z": "51c6499e43ce6873",  
"name": "",  
"host": "192.145.1.",  
"port": "3306",  
"beserver": "client",  
"base64": false,  
"end": true,  
"tls": "",  
"x": 580,  
"y": 180,  
"wires":   
}  
]

i want to store this output 5 in local storage when the internet is disconnected ,once the device reconnect to the internet it should send the stored data  
please help sir,  
this only i have to do with node red please sir

---

<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:** [16 September 2022 06:31 UTC](https://discourse.nodered.org/t/raspberry-pi-not-connected-with-internet-than-node-red-should-store-data-in-device-once-it-reconnected-to-the-internet-it-should-send-to-the-cloud-using-tcpip/67746/5 "2022-09-16T06:31:58Z")

</div>

Did you see my previous reply?

> [@Colin](#):
>
> For the online/offline part, search on the node red flows site for guaranteed delivery and you will find a flow that does that.

---

<div class="post-metadata">

**Author:** ![t4amit](https://avatars.discourse-cdn.com/v4/letter/t/47e85d/32.png) [@t4amit](https://discourse.nodered.org/u/t4amit)\
**Post date:** [16 September 2022 09:18 UTC](https://discourse.nodered.org/t/raspberry-pi-not-connected-with-internet-than-node-red-should-store-data-in-device-once-it-reconnected-to-the-internet-it-should-send-to-the-cloud-using-tcpip/67746/6 "2022-09-16T09:18:03Z")

</div>

i did not found anything please send url or something

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [16 September 2022 09:23 UTC](https://discourse.nodered.org/t/raspberry-pi-not-connected-with-internet-than-node-red-should-store-data-in-device-once-it-reconnected-to-the-internet-it-should-send-to-the-cloud-using-tcpip/67746/7 "2022-09-16T09:23:24Z")

</div>

[https://flows.nodered.org/search?term=guaranteed](https://flows.nodered.org/search?term=guaranteed)

I'm not familiar with the flow that it shows but I have a suspicion that if @Colin recommends it he probably knows it's reliable! 😜

ps "this project is my life" - It would be interesting to know a bit more about the project.

---

<div class="post-metadata">

**Author:** ![t4amit](https://avatars.discourse-cdn.com/v4/letter/t/47e85d/32.png) [@t4amit](https://discourse.nodered.org/u/t4amit)\
**Post date:** [16 September 2022 10:06 UTC](https://discourse.nodered.org/t/raspberry-pi-not-connected-with-internet-than-node-red-should-store-data-in-device-once-it-reconnected-to-the-internet-it-should-send-to-the-cloud-using-tcpip/67746/8 "2022-09-16T10:06:30Z")

</div>

Dear Sir,

i started startup campany sir this is my first project what customer want we have to use TCP/IP to Send Data to the cloud .  
by using MQTT msg send on unexpected disconnection but there is no option wih tcp ip the url that you send this is also not works.  
i also don't know about node red flow .and i don't know what to do next

Regards  
amit

---

<div class="post-metadata">

**Author:** ![t4amit](https://avatars.discourse-cdn.com/v4/letter/t/47e85d/32.png) [@t4amit](https://discourse.nodered.org/u/t4amit)\
**Post date:** [16 September 2022 10:11 UTC](https://discourse.nodered.org/t/raspberry-pi-not-connected-with-internet-than-node-red-should-store-data-in-device-once-it-reconnected-to-the-internet-it-should-send-to-the-cloud-using-tcpip/67746/9 "2022-09-16T10:11:34Z")

</div>

i am already invested my everything there is no way.

---

<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:** [16 September 2022 10:13 UTC](https://discourse.nodered.org/t/raspberry-pi-not-connected-with-internet-than-node-red-should-store-data-in-device-once-it-reconnected-to-the-internet-it-should-send-to-the-cloud-using-tcpip/67746/10 "2022-09-16T10:13:44Z")

</div>

Did you read the instructions on how to use the flow? Have you imported it and tried to understand what it does?

---

<div class="post-metadata">

**Author:** ![t4amit](https://avatars.discourse-cdn.com/v4/letter/t/47e85d/32.png) [@t4amit](https://discourse.nodered.org/u/t4amit)\
**Post date:** [16 September 2022 10:25 UTC](https://discourse.nodered.org/t/raspberry-pi-not-connected-with-internet-than-node-red-should-store-data-in-device-once-it-reconnected-to-the-internet-it-should-send-to-the-cloud-using-tcpip/67746/11 "2022-09-16T10:25:19Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/7/37396dfd2b7e124e47169df0b87538b26661ef8a.png)

---

<div class="post-metadata">

**Author:** ![t4amit](https://avatars.discourse-cdn.com/v4/letter/t/47e85d/32.png) [@t4amit](https://discourse.nodered.org/u/t4amit)\
**Post date:** [16 September 2022 10:27 UTC](https://discourse.nodered.org/t/raspberry-pi-not-connected-with-internet-than-node-red-should-store-data-in-device-once-it-reconnected-to-the-internet-it-should-send-to-the-cloud-using-tcpip/67746/12 "2022-09-16T10:27:26Z")

</div>

now tcpip in diconnected so wait for msg is zero only ,  
it should buffer sir ji than fail stage should start

---

<div class="post-metadata">

**Author:** ![t4amit](https://avatars.discourse-cdn.com/v4/letter/t/47e85d/32.png) [@t4amit](https://discourse.nodered.org/u/t4amit)\
**Post date:** [16 September 2022 10:28 UTC](https://discourse.nodered.org/t/raspberry-pi-not-connected-with-internet-than-node-red-should-store-data-in-device-once-it-reconnected-to-the-internet-it-should-send-to-the-cloud-using-tcpip/67746/13 "2022-09-16T10:28:14Z")

</div>

after reconnecting to the internet no message sended via tcpip

---

<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:** [16 September 2022 10:39 UTC](https://discourse.nodered.org/t/raspberry-pi-not-connected-with-internet-than-node-red-should-store-data-in-device-once-it-reconnected-to-the-internet-it-should-send-to-the-cloud-using-tcpip/67746/14 "2022-09-16T10:39:21Z")

</div>

You must work out how to know when a TCP transaction has completed ok, and send the ok message to let the next one through, or if the TCP has failed and send the failed message.

---

<div class="post-metadata">

**Author:** ![t4amit](https://avatars.discourse-cdn.com/v4/letter/t/47e85d/32.png) [@t4amit](https://discourse.nodered.org/u/t4amit)\
**Post date:** [16 September 2022 10:42 UTC](https://discourse.nodered.org/t/raspberry-pi-not-connected-with-internet-than-node-red-should-store-data-in-device-once-it-reconnected-to-the-internet-it-should-send-to-the-cloud-using-tcpip/67746/16 "2022-09-16T10:42:38Z")

</div>

if i know this things how to do that than why should i ask ,if you want i can pay u as well . i already buy 200 raspberry pi

---

<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:** [16 September 2022 11:09 UTC](https://discourse.nodered.org/t/raspberry-pi-not-connected-with-internet-than-node-red-should-store-data-in-device-once-it-reconnected-to-the-internet-it-should-send-to-the-cloud-using-tcpip/67746/17 "2022-09-16T11:09:27Z")

</div>

The flow does everything else you need, storing messages when they cannot be sent and retrying to check whether the connection is good again. All you have to do is to detect the TCP error or success. I have not used the TCP node, but presumably it indicates that a timeout has occurred. Have you checked to see if there are messages from the catch or complete nodes? Make sure you have linked them to that node.  
I am retired and on holiday so can only point you in the right direction.

---

<div class="post-metadata">

**Author:** ![mrdvt92](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mrdvt92/32/33122_2.png) [@mrdvt92](https://discourse.nodered.org/u/mrdvt92)\
**Post date:** [21 September 2022 00:27 UTC](https://discourse.nodered.org/t/raspberry-pi-not-connected-with-internet-than-node-red-should-store-data-in-device-once-it-reconnected-to-the-internet-it-should-send-to-the-cloud-using-tcpip/67746/18 "2022-09-21T00:27:30Z")

</div>

Just pop the messages on a queue like RabbitMQ. Then on the Raspberry pi side just connect and process everything on the queue until it's empty then disconnect. I use the STOMP protocol for Rabbit MQ mostly with Perl but I see node-red has node-red-node-stomp as well.
