LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to send telnet commands with TCP/IP

I need to send telnet commands (and read response data) from my instrument in labview.   I have tried using system exec to launch telnet with no success (doesn't take the standard input correctly).  I can open my instrument connection with TCP/IP open on port 23 without error.  When I try to send my ASCII command with TCP/IP write, nothing happens.  Is there some telnet protocol specific things I need to do to the string I am sending with TCP/IP write?  I am able to connect and send/receive data with both windows telnet & hyperterminal.  any ideas?  I can not buy the internet toolkit with telnet, so please do not suggest this.

thanks,
-Joe Craig
0 Kudos
Message 1 of 6
(9,956 Views)
Based on this thread over at LAVA, it looks like the example given there didn't help. There's not really something specific about telnet. You send a string and wait for a response. In the example, did you try removing the end-of-line that gets appended to the command? Perhaps your instrument doesn't like that. What is your instrument and what does its documentation say?

For debugging, depending on how adept you are, you can try to see what is happening by using a packet sniffer program like Wireshark. You can have it running, connect to your instrument using Hyperterminal (I'm assuming that's what you were using when you said you launch telnet), and see what the strings going back and forth are. Then, you can do the same with the LabVIEW code and you can see what the differences are.
0 Kudos
Message 2 of 6
(9,937 Views)
Have you ever used "putty"?  There is a program called plink inside the putty.zip which is a command line version of putty which I have used and it works great

just put the directory in the path variable and use the system exec vi

Message Edited by James R on 04-11-2007 11:14 AM

- James

Using LV 2012 on Windows 7 64 bit
0 Kudos
Message 3 of 6
(9,935 Views)
You can use the system exec.vi and use the command line options for the plink program that I suggested earlier and use the standard out of the system exec.vi but in order to get the results from the standard out and standard error you cannot use the run minimized option.

Message Edited by James R on 04-11-2007 11:29 AM

- James

Using LV 2012 on Windows 7 64 bit
0 Kudos
Message 4 of 6
(9,929 Views)
I tried using plink, but could not get my batch file to read in and run the command.  I used the -m [filename] and it did not work (even manually from command line).  Besides, I need these commands to run minimized, can't have the UI popping windows all the time.  I will try sniffing tcp/ip and matching what happens in telnet to what I'm doing with TCP write.vi 
Does someone have an example of using putty to run telnet with system exec.vi?
0 Kudos
Message 5 of 6
(9,923 Views)
Hi,

You can used extraputty which is addon of putty and offered an telnet API for TestStand.
you can send and received telnet data from teststand.

I hope that can help you.

Sorry for my bad english ....

(the installer add the Telnet step to Teststand automaticaly)

extraputty : http://extraputty.free.fr


Message Edité par asebt le 01-29-2008 04:35 PM
0 Kudos
Message 6 of 6
(9,323 Views)