Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: telnet to Cognex In-Sight 4001 camera

Reply
Thread Tools

Re: telnet to Cognex In-Sight 4001 camera

 
 
chris.annin@gmail.com
Guest
Posts: n/a
 
      02-25-2013
yes, ive connected successfully using hyperterminal after I login it asks for user and I type admin press enter then it ask for password and type password press enter and it all works fine. using python ive tried ending both with "\n" and "\r\n" im thoroughly confused




On Monday, February 25, 2013 11:24:22 AM UTC-8, square.steve wrote:
> At the risk of stating the blindingly obvious, have you run a 'real' telnet session to see what *a successful conversation looks like? Might give you some useful pointers for your debug session.
>
>
> Steve
>
>
>
> Sent from a Galaxy far, far away....
>
>
> -------- Original message --------
> From: (E-Mail Removed)
> Date:
> To: (E-Mail Removed)
> Subject: telnet to Cognex In-Sight 4001 camera
>
>
> Hello,* ive been struggling with this for a couple weeks now and was hoping someone might be able to help.* I have an older Cognex camera that Ineed to communicate with via telnet.* I can get a response from the camera when I initiate a telnet session but I dont seem to get any response when I write the user name to the camera -* I havnt been able to get any response writing anything. Im using python 2.7 and windows xp.* here is the code:
> [code]
> >>>import sys
> >>>import telnetlib
> >>>HOST = "10.31.18.21"
> >>>USER = "admin"
> >>>tn = telnetlib.Telnet(HOST)
> >>>tn.read_until("Login: ")

> "Welcome to In-Sight(R) 4001 Session 1\r\nUser:"
> >>>tn.write(USER + "\r\n")
> >>>tn.read_until("User: ")

> Traceback (most recent call last):
> * File "<stdin>", line 1, in <module>
> * File "C:\Python27\lib\telnetlib.py", line 319,
> *** return self.read_very_lazy()
> * File "C:\Python27\lib\telnetlib.py", line 395,
> *** raise EOFError, 'telnet connection closed'
> EOFError: telnet connection closed
> >>>

> [\code]
>
> if i do a read_all instead of read_until for user I just get "..." returned.* Im assuming tn.write command isnt working?* any help would be greatly appreciated.
>
> thank you
>
> Chris
> --
> http://mail.python.org/mailman/listinfo/python-list


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
telnet to Cognex In-Sight 4001 camera chris.annin@gmail.com Python 5 02-26-2013 01:44 AM
Re: telnet to Cognex In-Sight 4001 camera MRAB Python 2 02-25-2013 09:52 PM
Re: telnet to Cognex In-Sight 4001 camera Chris Annin Python 0 02-25-2013 08:27 PM
Telnet - attempting to initiate a telnet session within an established telnet session Carcarius Ruby 0 12-06-2007 03:26 AM



Advertisments