Basic Telnet Connection Help
-
@btmclain
I don't get what you're trying to do.Where are you running the python script? On your PC?
If so, it's listening, but there's nothing that is going to try to connect to your PC.
Maybe you want to run a python script on your PC that connects to the Duet's telent port?
-
@alankilian Hi thanks for the quick reply. To be honest I am not really sure what I am doing.
Yes I am running the python script from my PC.
I was under the impression that the Duet would send a message to the specified port on my pc. I am obviously mistaken. Let me try to connect to a telnet port on the duet and see how that goes.
-
@alankilian so I used the following line to try to connect to the machine:
sock = socket.create_connection((duet_host, 23), timeout=10)
I am getting this response: [WinError 10061] No connection could be made because the target machine actively refused it
Is there a security setting within the duet that is causing this to happen?
-
Looking HERE
I got this working:#!/usr/bin/env python3 import socket HOST = '192.168.0.104' # The server's hostname or IP address PORT = 23 # The port used by the server with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.connect((HOST, PORT)) data = s.recv(1024) print('Received', repr(data)) data = s.recv(1024) print('Received', repr(data))
192.168.0.104 is the IP address of my duet and I got several "message" printed from Python.
I'm not a Python guy, but you might get farther with this.
-
@alankilian That worked! Thank you very much for the help. I will run with it from here
-
@btmclain Excellent! Glad to be of service.
-
@btmclain which Duet are you using, and which firmware version?
You can run a program such as Putty on the PC to test the Telnet connection.
-
@dc42 We are using a Duet 3 MB 6HC with the latest firmware, 3.3 I believe? Alan's answer was perfect, it is exactly what I was looking for.
-
This post is deleted! -
-
-
@alankilian i know this topic is old but ive been looking into the same thing im trying to grab the macros from the duet but ive had no joy so far using python