Python Forum
Sending command using telnet
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sending command using telnet
#1
Hi guys,

I am relative new in python programming and I want to send some commands to cognex camera using telnet.

I already try with PUTTY software and camera receive command properly.

Now I want to try with python script and I am probably doing something wrong, because camera don't receive command that i want to send.

This is script that i try:
import sys
import telnetlib

HOST = "172.20.1.34"
PORT = "23"

telnetObj=telnetlib.Telnet(HOST,PORT)
message = (b"||>SET CAMERA.GAIN 3")
telnetObj.write(message)
output=telnetObj.read_all()
print(output)
telnetObj.close()
Any ideas what I am doing wrong please?

Thanks in advance
Reply
#2
There's a good example in the docs: https://docs.python.org/3/library/telnetlib.html
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Telnet command in Python 3.9 Dre83 0 1,931 Nov-11-2020, 11:42 AM
Last Post: Dre83
  Serial to telnet using Python Charles_Linquist 2 6,130 Jun-17-2019, 04:37 PM
Last Post: DeaD_EyE
  Multi thread telnet issue anna 0 2,099 Mar-29-2018, 05:35 PM
Last Post: anna
  telnet unexpected output printing anna 3 3,539 Jan-17-2018, 01:16 PM
Last Post: anna
  help required to parsing telnet output anna 8 8,466 Jan-12-2018, 11:05 AM
Last Post: anna
  telnet stuck when get Press any key to continue anna 2 4,704 Dec-31-2017, 11:34 AM
Last Post: anna

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020