# Telnet from Node-RED running on Windows 10

**URL:** <https://discourse.nodered.org/t/telnet-from-node-red-running-on-windows-10/47718>\
**Category:** General\
**Created:** [27 June 2021 15:13 UTC](https://discourse.nodered.org/t/telnet-from-node-red-running-on-windows-10/47718 "2021-06-27T15:13:10Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![intmech](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/intmech/32/18283_2.png) [@intmech](https://discourse.nodered.org/u/intmech)\
**Post date:** [27 June 2021 15:13 UTC](https://discourse.nodered.org/t/telnet-from-node-red-running-on-windows-10/47718/1 "2021-06-27T15:13:10Z")

</div>

In linux I'm able to run telnet in an exec node. I can't seem to make that happen in windows 10 and I'm not certain why.

I have tried to use node-red-contrib-telnet-client but I can't find any documentation or examples to help just get over the first hurdle which is sending login and password to a telnet server from node-red.

I have read the suggestion several times to use the TCP node to talk to a telnet server and I have been able to get the telnet server to negotiate options with the TCP request node by sending buffers of arrays with "will won't do don't" commands detailed here: [Telnet Options](https://www.iana.org/assignments/telnet-options/telnet-options.xhtml#telnet-options-1)

I still can't figure out how to send a TCP request that lets the Telnet server know that I would like to open a session with a username and password as I would in cmd or the terminal with the telnet command.

I feel like I'm missing something super basic here. In the end I'm attempting to have node-red access the telnet server on some Siemens PLCs to be able to pull out a few values.

Any help is greatly appreciated.

---

<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:** [27 June 2021 18:34 UTC](https://discourse.nodered.org/t/telnet-from-node-red-running-on-windows-10/47718/2 "2021-06-27T18:34:07Z")

</div>

> [@intmech](#):
>
> In the end I'm attempting to have node-red access the telnet server on some Siemens PLCs to be able to pull out a few values

Are the S7 nodes not an option?

---

<div class="post-metadata">

**Author:** ![alexander77](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@alexander77](https://discourse.nodered.org/u/alexander77)\
**Post date:** [27 June 2021 19:34 UTC](https://discourse.nodered.org/t/telnet-from-node-red-running-on-windows-10/47718/3 "2021-06-27T19:34:27Z")

</div>

If it is really a simple telnet server it should be running like this:

- establish a connection
- the server will send to you: 'Username'
- you should respond with a valid username followed by a \n
- the server sends 'Password'
- you should send a valid password followed by a \n
- the server sends a welcome message or simply a system prompt.

At least this is how it works on my AMX or Crestron controllers.

---

<div class="post-metadata">

**Author:** ![tree-frog](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tree-frog/32/89303_2.png) [@tree-frog](https://discourse.nodered.org/u/tree-frog)\
**Post date:** [27 June 2021 19:49 UTC](https://discourse.nodered.org/t/telnet-from-node-red-running-on-windows-10/47718/4 "2021-06-27T19:49:00Z")

</div>

On your windows system I would start by using Hyperterminal. You can install it quite easily and you can download it free. You can also use PuTTY. Just establish a connection on IP address and Port 23. If your Telnet device, in this case I'm assuming, it's the PLC, you should get a simple screen text menu which probably will accept commands. Telnet expects screen interactions, so it sends screen text values for menus and display. You can probably use it from nod-RED, but handle the screen information from the buffer.  
Using Telnet, you need to connect to the Telnet server, sometimes this takes something to initiate that, like a carriage return once connected.

---

<div class="post-metadata">

**Author:** ![intmech](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/intmech/32/18283_2.png) [@intmech](https://discourse.nodered.org/u/intmech)\
**Post date:** [27 June 2021 21:04 UTC](https://discourse.nodered.org/t/telnet-from-node-red-running-on-windows-10/47718/5 "2021-06-27T21:04:09Z")

</div>

The devices are model PXC-36, the only available data access is via telnet. I do not think the s7 nodes are an option.

---

<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:** [27 June 2021 21:08 UTC](https://discourse.nodered.org/t/telnet-from-node-red-running-on-windows-10/47718/6 "2021-06-27T21:08:13Z")

</div>

Does that PLC have bacnet ?

---

<div class="post-metadata">

**Author:** ![intmech](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/intmech/32/18283_2.png) [@intmech](https://discourse.nodered.org/u/intmech)\
**Post date:** [27 June 2021 21:09 UTC](https://discourse.nodered.org/t/telnet-from-node-red-running-on-windows-10/47718/7 "2021-06-27T21:09:22Z")

</div>

only via mstp not over IP

---

<div class="post-metadata">

**Author:** ![intmech](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/intmech/32/18283_2.png) [@intmech](https://discourse.nodered.org/u/intmech)\
**Post date:** [27 June 2021 21:20 UTC](https://discourse.nodered.org/t/telnet-from-node-red-running-on-windows-10/47718/8 "2021-06-27T21:20:15Z")

</div>

What I have done here to test is use an intel nuc running Ubuntu 20.04.2 to install telnetd  
username is openhab password is habopen  
I can confirm that I can get telnet access from the terminal

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/9/a932df8082be76047104bb92682fe5aee3b975c1.png)

However I can't seem to get responses that I can parse when I attempt to use the TCP node.  
When I listen on the tcp in node I get this buffer[12] before I ever try to send anything to the telnet server.  
Then I get the same as a response if I use the request node.  
I have worked out that it is the server making options negotiations

0: 255 IAC  
1: 253 DO  
2: 24 terminal type  
3: 255 IAC  
4: 253 DO  
5: 32 terminal speed  
6: 255 IAC  
7: 253 DO  
8: 35 X-DISPLAY-LOCATION (XDISPLOC)  
9: 255 IAC  
10: 253 DO  
11: 39 NEW-ENVIRON

I haven't figured out how to get the telnet server to ask for my password the way the terminal will if I pass the option -l username along with telnet

Here's a stripped down flow of where I'm starting from. I also tried this using a raspi as the telnet server will the same results.

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

```auto
[{"id":"88d86f07.b3b768","type":"tab","label":"telnet","disabled":false,"info":""},{"id":"26096609.db0c12","type":"inject","z":"88d86f07.b3b768","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":280,"y":140,"wires":[["5cf26d60.9c4dfc"]]},{"id":"5cf26d60.9c4dfc","type":"function","z":"88d86f07.b3b768","name":"uname","func":"msg.payload = Buffer.from(\"openhab\\r\\n\");\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":430,"y":140,"wires":[["6ca876fc.a3624"]]},{"id":"531ef101.6d50a8","type":"inject","z":"88d86f07.b3b768","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":280,"y":180,"wires":[["e84bb2e8.a89898"]]},{"id":"e84bb2e8.a89898","type":"function","z":"88d86f07.b3b768","name":"pword","func":"msg.payload = Buffer.from(\"habopen\\r\\n\");\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":430,"y":180,"wires":[["6ca876fc.a3624"]]},{"id":"405767cc.8453f","type":"inject","z":"88d86f07.b3b768","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"telnet -l openhab","payloadType":"str","x":400,"y":80,"wires":[["6ca876fc.a3624"]]},{"id":"5290eb0f.d598fc","type":"tcp in","z":"88d86f07.b3b768","name":"","server":"client","host":"192.168.3.33","port":"23","datamode":"stream","datatype":"buffer","newline":"","topic":"","base64":false,"x":690,"y":160,"wires":[["623e4301.145cf4"]]},{"id":"623e4301.145cf4","type":"debug","z":"88d86f07.b3b768","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":970,"y":160,"wires":[]},{"id":"6ca876fc.a3624","type":"tcp request","z":"88d86f07.b3b768","server":"192.168.3.33","port":"23","out":"sit","splitc":" ","name":"","x":700,"y":80,"wires":[["a1c736d5.0b8dc"]]},{"id":"a1c736d5.0b8dc","type":"debug","z":"88d86f07.b3b768","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":940,"y":80,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![intmech](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/intmech/32/18283_2.png) [@intmech](https://discourse.nodered.org/u/intmech)\
**Post date:** [17 July 2021 21:07 UTC](https://discourse.nodered.org/t/telnet-from-node-red-running-on-windows-10/47718/9 "2021-07-17T21:07:45Z")

</div>

Ok I figured out what I didn't know that I needed to understand to make this work and I thought I'd share my findings with anyone else that might try to make a node-red telnet connection. I didn't use the telnet-client, I couldn't find any resources to understand how to use it. I didn't use TCP-IN or TCP-OUT nodes, I only used one TCP-Request node set to never close the connection. The biggest issue I had was when trying to replicate the commands I would type into a terminal to open the telnet connection I needed to use the carriage return and new line as a buffer and not a string. Instead of string = '\r\n' you need to send buffer = [80] for the telnet server to accept the return character.

---

<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:** [15 September 2021 21:07 UTC](https://discourse.nodered.org/t/telnet-from-node-red-running-on-windows-10/47718/10 "2021-09-15T21:07:45Z")

</div>

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