TCP IP Send receive data

HI,

I'm new to Node Red
I have RFID reader which works on TCPIP and i need to connect reader using TCPIP and its port i.e. 2189

I'm unable to connect Reader and get data from reader using Node red. I need to connect reader and get RFID tag data as and when it reads it should through data and i should store in MSSQL database.

Request you to please share sample code.

Your earliest reply is highly appreciated.

Thanks & Regards,

Haresh Maheshwari

First step is what have YOU tried?

1 Like

Okay, starting from the start. Node-RED has a TCP node available that you can use. It's builtin so you won't have to install anything for it. Next thing you need is knowing at what IP address the reader is available, and the correct port.

Thirdly, look at the Flows library for MSSQL nodes/setup. https://flows.nodered.org/?term=mssql&num_pages=1

But like @ukmoose wrote before I could hit reply, what have you tried yourself? These three steps you could have found yourself by reading the documentation on the site, and clicking on the big word "flows" in the header, as well as "documentation" in the same bar. And the TCP node is builtin so it's easy to see when you start Node-RED for the first time as well :slight_smile:

1 Like

Thanks and appreciate your prompt reply.

please find attached code tried by myself.

[{"id":"299e1981.268db6","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"6173d535.077d9c","type":"inject","z":"299e1981.268db6","name":"","topic":"","payload":"read","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":120,"wires":[["990451fe.b3224"]]},{"id":"990451fe.b3224","type":"tcp request","z":"299e1981.268db6","server":"192.168.0.199","port":"2189","out":"sit","splitc":" ","name":"","x":520,"y":80,"wires":[["6dacc9e8.853a38"]]},{"id":"6dacc9e8.853a38","type":"debug","z":"299e1981.268db6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":590,"y":160,"wires":},{"id":"55059129.65c03","type":"tcp request","z":"299e1981.268db6","server":"localhost","port":"90","out":"time","splitc":"0","name":"","x":930,"y":240,"wires":[]},{"id":"37f495b3.3a633a","type":"debug","z":"299e1981.268db6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":920,"y":360,"wires":},{"id":"6bb40740.261c28","type":"tcp request","z":"299e1981.268db6","server":"localhost","port":"90","out":"time","splitc":"0","name":"","x":930,"y":300,"wires":[]},{"id":"bac625a2.145788","type":"udp in","z":"299e1981.268db6","name":"","iface":"","port":"93","ipv":"udp4","multicast":"false","group":"","datatype":"utf8","x":280,"y":540,"wires":[["915f1047.05736"]]},{"id":"915f1047.05736","type":"debug","z":"299e1981.268db6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":490,"y":540,"wires":}]

Unfortunately your flow isn't currently importable.Please read the following post How to share code or flow json and then edit the above message.

[{"id":"299e1981.268db6","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"6173d535.077d9c","type":"inject","z":"299e1981.268db6","name":"","topic":"","payload":"read","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":120,"wires":[["990451fe.b3224"]]},{"id":"990451fe.b3224","type":"tcp request","z":"299e1981.268db6","server":"192.168.0.199","port":"2189","out":"sit","splitc":" ","name":"","x":520,"y":80,"wires":[["6dacc9e8.853a38"]]},{"id":"6dacc9e8.853a38","type":"debug","z":"299e1981.268db6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":590,"y":160,"wires":},{"id":"55059129.65c03","type":"tcp request","z":"299e1981.268db6","server":"localhost","port":"90","out":"time","splitc":"0","name":"","x":930,"y":240,"wires":[]},{"id":"37f495b3.3a633a","type":"debug","z":"299e1981.268db6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":920,"y":360,"wires":},{"id":"6bb40740.261c28","type":"tcp request","z":"299e1981.268db6","server":"localhost","port":"90","out":"time","splitc":"0","name":"","x":930,"y":300,"wires":[]},{"id":"bac625a2.145788","type":"udp in","z":"299e1981.268db6","name":"","iface":"","port":"93","ipv":"udp4","multicast":"false","group":"","datatype":"utf8","x":280,"y":540,"wires":[["915f1047.05736"]]},{"id":"915f1047.05736","type":"debug","z":"299e1981.268db6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":490,"y":540,"wires":}]Preformatted text

Still not... do it again but replace the "Preformatted text" that shows when you click on </> by your flow.

I will share you code shortly

Thanks for immediate response.

Can you share a sample link showing TCPIP receiving data!

So you appear to be trying to connect to port 90 on the same machine that Node-RED is running (localhost) ? Are you sure that's the correct details for your RFID reader?
To connect via TCP to your RFID reader you would need to enter your RFID readers IP address and the correct port number. But please post your flow in the correct format

[{"id":"299e1981.268db6","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"6173d535.077d9c","type":"inject","z":"299e1981.268db6","name":"","topic":"","payload":"read","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":120,"wires":[["990451fe.b3224"]]},{"id":"990451fe.b3224","type":"tcp request","z":"299e1981.268db6","server":"192.168.0.199","port":"2189","out":"sit","splitc":" ","name":"","x":520,"y":80,"wires":[["6dacc9e8.853a38"]]},{"id":"6dacc9e8.853a38","type":"debug","z":"299e1981.268db6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":590,"y":160,"wires":},{"id":"55059129.65c03","type":"tcp request","z":"299e1981.268db6","server":"localhost","port":"90","out":"time","splitc":"0","name":"","x":930,"y":240,"wires":[]},{"id":"37f495b3.3a633a","type":"debug","z":"299e1981.268db6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":920,"y":360,"wires":},{"id":"6bb40740.261c28","type":"tcp request","z":"299e1981.268db6","server":"localhost","port":"90","out":"time","splitc":"0","name":"","x":930,"y":300,"wires":[]},{"id":"bac625a2.145788","type":"udp in","z":"299e1981.268db6","name":"","iface":"","port":"93","ipv":"udp4","multicast":"false","group":"","datatype":"utf8","x":280,"y":540,"wires":[["915f1047.05736"]]},{"id":"915f1047.05736","type":"debug","z":"299e1981.268db6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":490,"y":540,"wires":}]

Above code for your perusal

Export your flow again and follow this topic

[{"id":"299e1981.268db6","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"6173d535.077d9c","type":"inject","z":"299e1981.268db6","name":"","topic":"","payload":"read","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":120,"wires":[["990451fe.b3224"]]},{"id":"990451fe.b3224","type":"tcp request","z":"299e1981.268db6","server":"192.168.0.199","port":"2189","out":"sit","splitc":" ","name":"","x":430,"y":40,"wires":[["6dacc9e8.853a38"]]},{"id":"6dacc9e8.853a38","type":"debug","z":"299e1981.268db6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":590,"y":160,"wires":[]},{"id":"55059129.65c03","type":"tcp request","z":"299e1981.268db6","server":"localhost","port":"90","out":"time","splitc":"0","name":"","x":930,"y":240,"wires":[[]]},{"id":"37f495b3.3a633a","type":"debug","z":"299e1981.268db6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":920,"y":360,"wires":[]},{"id":"6bb40740.261c28","type":"tcp request","z":"299e1981.268db6","server":"localhost","port":"90","out":"time","splitc":"0","name":"","x":930,"y":300,"wires":[[]]},{"id":"bac625a2.145788","type":"udp in","z":"299e1981.268db6","name":"","iface":"","port":"93","ipv":"udp4","multicast":"false","group":"","datatype":"utf8","x":280,"y":540,"wires":[["915f1047.05736"]]},{"id":"915f1047.05736","type":"debug","z":"299e1981.268db6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":490,"y":540,"wires":[]}]

Please check and advice

What are you expecting someone to check?

Only you know which RFID reader you are running and therefore how you need to connect it.
I would start off by adding a debug node to the TCP node you are using if you are sure that is configured correctly and see if you get any data.
If not, you need to understand how to get a reading from the RFID readers manual.

Hi,

When i connect reader to Putty and use reader ip address and port it gets connected
When i send command it replies with tag data if available same i want to do it using Node-red

My request is that if you can share me FLOW using which i can create connection and get data

I'm hear to learn and explore if you can help and guide is appreciated

Please reply or share link from i can learn Node red in detailed.

Sure

https://nodered.org/docs/user-guide/
https://cookbook.nodered.org

2 Likes

Thanks for your reply But it does not have details on getting TCP IP data can you share link having details of TCP IP receiving data and Sending data