10-20-2008 12:56 PM
Does your remote side talk Telnet? Because if it doesn't tbd's library may not be of a lot of help other than to do see how TCP/IP communication should be implemented in LabVIEW.
As to the problem of interactive control of command line tools from LabVIEW I did create a library on Openg in the past that allows to launch an executable like when using System Exec.vi but then return pipe handles to the standard IO and optional standard error and has other VIs to read and write from and to those pipes.
This library however while working for what I needed it, isn't released since it doesn't always work perfectly in every situation. So the only way to download it is either from CVS or from some posts over on LAVA (if you look for pipe there). But if you can get tunnels through putty by just using System Exec.vi that would be probably prefarable since it will work more reliable than the current pipe library I have written.
Rolf Kalbermatter
10-20-2008 02:33 PM
Hi james,
I don't know whether LV_Comm will work in conjuction with Putty/SSH. If the SSH "tunnel" described by MaxCrunch is completely transparent, then perhaps so. Rolf is right - this LLB is expecting a Telnet service on the target PC!
To logon via Telnet (per example on diagram) Username is append to the VISA resource;
WITHOUT Username: VISA Resource name = TCPIP::127.0.0.1:23
WITH Username: VISA Resource name = TCPIP::127.0.0.1:23::<UserName>
Password (if any) is supplied in the "Mfr.ID" string
Note: SSH may require you connect on a different PORT (like 22) instead of 23
I admit the method for providing username/pwd isn't pretty - later Driver models rename "Mfr".ID to "Parameters" and use ML syntax to provide them -
but this is 99.9% the same code that was working reliably for me. The only change made is to the "'Connected'Prompt(if any)" string which was formerly hard-wired to a device-specific value.
Cheers!
04-22-2012 11:07 AM
Hello All,
I have to communicate over a telnet session too. I believe there is some options:
1) Buy the NI Labview Toolkit and use it's telnet VIs (US$ 550, I avoid this option)
2) Implement a simple version of the Telnet Protocol in LabVIEW (using TCP or VISA functions)
This sounds good for me, because I have to send only ASCII strings, no special control for terminal sessions is needed for application.
Have someone done this? Could you share you code?
3) Use telnet implementation of plink (puTTY).
But using System Exec.vi (plinl.exe) we are able only to send commands (or a script).
I need send commands, read the answer and than make decision to send other commands.
How can I open "channel" in LabVIEW?
In TCL:
set telnetDUTChannel [open "|plink -telnet 172.0.0.1" w+] # open a telnet channel
puts MyCommand $telnetDUTChannel # write MyCommand to the telnet channel
read $telnetDUTChannel # read the answer.
What is the better option?
Thanks in advance
Marcio
04-23-2012 02:09 AM
Point 1) is easiest but costs you.
For point 2), have you looked at the LV_COMM.LLB in the post from tbd? It is basically a Telnet VI library. It's not the most straighforward way of implementing a Telnet library and I'm sure you would have less trouble to understand how to use the Telnet library in NI's Internet Toolkit but it is something.
For point 3) you should check out my post about the OpenG Pipe library (and understand the caveats I'm mentioning there with this library).
04-23-2012 08:34 AM
thanks, I will try to understand 2) and 3).
However, I observed Telnet simply uses ASCII (0-127) to send strings (these are my device's commads).
I don't need to use telnet functions (op codes 128-255).
So I will try to use simple TCP or VISA read/write functions.
Please let me know if it is enough for someone's else application
Thanks for you quick comments,
Marcio