From: Jim K. <ji...@ji...> - 2004-02-28 18:45:24
|
Hello all, I was wondering if anyone has done any work with LabVIEW and SSH. I was looking at the PuTTY FAQ to see if there was a programmatic interface = and saw the following: <http://www.chiark.greenend.org.uk/~sgtatham/putty/faq.html#A.4.3> ##############=20 Probably your best bet is to use Plink, the command-line connection = tool. If you can start Plink as a second Windows process, and arrange for your primary process to be able to send data to the Plink process, and = receive data from it, through pipes, then you should be able to make SSH = connections from your program. This is what CVS for Windows does, for example. ############## I haven't done any works with pipes in Windows and did a little bit of research. I found the following on MSDN: <http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/dllpr= oc/ba se/creating_a_child_process_with_redirected_input_and_output.asp> Has anyone gotten pipes working in LabVIEW? Would anyone more C++ savvy than myself be interested in working with me to get a generic "System = Exec w/ Pipes" working? I envision a DLL that could be called from LabVIEW = (or maybe LabVIEW could call WinAPI DLLs directly) with functions for = Spawning the Process (the command-line executable), Reading from, and Writing to = a Pipe for communication with the running executable. Regards, -Jim |
From: Rolf K. <rol...@ci...> - 2004-02-29 21:31:58
|
> -----Original Message----- > From: Jim Kring [mailto:ji...@ji...] > Sent: Sat, February 28, 2004 7:42 PM > To: 'OpenGToolkit-Developers' > Subject: LabVIEW SSH Tools >=20 >=20 > Hello all, >=20 > I was wondering if anyone has done any work with LabVIEW and=20 > SSH. I was > looking at the PuTTY FAQ to see if there was a programmatic=20 > interface and > saw the following: >=20 > <http://www.chiark.greenend.org.uk/~sgtatham/putty/faq.html#A.4.3> >=20 > ##############=20 > Probably your best bet is to use Plink, the command-line=20 > connection tool. If > you can start Plink as a second Windows process, and arrange for your > primary process to be able to send data to the Plink process,=20 > and receive > data from it, through pipes, then you should be able to make=20 > SSH connections > from your program. >=20 > This is what CVS for Windows does, for example. > ############## >=20 > I haven't done any works with pipes in Windows and did a little bit of > research. I found the following on MSDN: >=20 > = <http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/dllpr= oc/base/creating_a_child_process_with_redirected_input_and_output.asp> Has anyone gotten pipes working in LabVIEW? Would anyone more C++ savvy than myself be interested in working with me to get a generic "System = Exec w/ Pipes" working? I envision a DLL that could be called from LabVIEW = (or maybe LabVIEW could call WinAPI DLLs directly) with functions for = Spawning the Process (the command-line executable), Reading from, and Writing to = a Pipe for communication with the running executable. Regards, -Jim ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id438&op=3Dick _______________________________________________ OpenGToolkit-Developers mailing list Ope...@li... https://lists.sourceforge.net/lists/listinfo/opengtoolkit-developers |
From: Rolf K. <rol...@ci...> - 2004-02-29 21:43:13
|
Hi Jim =20 > I haven't done any works with pipes in Windows and did a little bit of > research. I found the following on MSDN: >=20 > = <http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/dllpr= oc/base/creating_a_child_process_with_redirected_input_and_output.asp> >Has anyone gotten pipes working in LabVIEW? Would anyone more C++ = savvy >than myself be interested in working with me to get a generic "System = Exec >w/ Pipes" working? I envision a DLL that could be called from LabVIEW = (or >maybe LabVIEW could call WinAPI DLLs directly) with functions for = Spawning >the Process (the command-line executable), Reading from, and Writing to = a >Pipe for communication with the running executable. I haven't done anything with pipes yet although it isn't really = difficult. The article you qoute seems fairly straight forward. I think the current System Exec most probably uses pipes for the three standard IO handles = to get the StdIn/Out and Err at all. What is the problem is that you do not get the handle back but just the entire text after execution of the = command. I think although it might be sort of possible to go directly from = LabVIEW to the Win32 API, it is a much better and smarter aproach to pack = everything into a DLL. Instead of returning the entire StdOut/Err text at once it = would return the three handles which can then be used by other DLL functions = to read and write to/from those handles. The code as shown in above example would almost work for that already. = At the moment I'm busy getting the Generic PortIO device driver working (Well = generic in that it supports Port IO in direct fast and indirect slow mode (the = one the current LabVIEW PortIO functions support) and possibly low mem access, = not multiplattform although I got a Linux example too, just need to adapt it = a bit to get it working nicely with LabVIEW.) I hope I have it ready end of = this week and then I'll look into the inherited pipe system exec if nobody else = stepped up to it until then. Rolf Kalbermatter |
From: Jim K. <ji...@ji...> - 2004-03-01 00:49:46
Attachments:
pipe2plink.tgz
pipe2plink.png
|
Hi Rolf, >=20 >=20 > Hi Jim > =20 > > I haven't done any works with pipes in Windows and did a=20 > > little bit of research. I found the following on MSDN: > >=20 > >=20 > > = <http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/dllp > > = roc/base/creating_a_child_process_with_redirected_input_and_output.asp > >=20 >=20 > >Has anyone gotten pipes working in LabVIEW? Would anyone more C++=20 > >savvy than myself be interested in working with me to get a generic=20 > >"System Exec w/ Pipes" working? I envision a DLL that could=20 > >be called=20 > >from LabVIEW (or maybe LabVIEW could call WinAPI DLLs directly) with=20 > >functions for Spawning the Process (the command-line executable),=20 > >Reading from, and Writing to a Pipe for communication with=20 > the running=20 > >executable. >=20 > I haven't done anything with pipes yet although it isn't=20 > really difficult. The article you qoute seems fairly straight=20 > forward. I think the current System Exec most probably uses=20 > pipes for the three standard IO handles to get the StdIn/Out=20 > and Err at all. What is the problem is that you do not get=20 > the handle back but just the entire text after execution of=20 > the command. You are right, I think. In fact, if you look at the "Pipes" function palette VIs in LabVIEW for Unix/Linux, "Open System Command Pipe.vi" = does just that (asynchronous system exec call with pipe outputs for Read/Write/Error). I have attached an example which uses this method to call plink (also included in the attachment). I have tgz'ed (rather = than zip'ed) the archive to preserve the Unix file system executable bit of = the plink file. I have also attached a screenshot (pipe2plink.png) of the example code for those out there without LabVIEW for Unix/Linux (and the needed "Pipes" VIs). This is a simple terminal-like GUI App that allows = you to execute single link commands via the secure shell and displays the = I/O in a buffered string indicator. >=20 > I think although it might be sort of possible to go directly=20 > from LabVIEW to the Win32 API, it is a much better and=20 > smarter aproach to pack everything into a DLL. Instead of=20 > returning the entire StdOut/Err text at once it would return=20 > the three handles which can then be used by other DLL=20 > functions to read and write to/from those handles. >=20 Yes, I think so too. I was noticing that the WinAPI functions use some compund (struct) data structures that might be hard to pass into a CLF = node from LabVIEW. > The code as shown in above example would almost work for that=20 > already. At the moment I'm busy getting the Generic PortIO=20 > device driver working (Well generic in that it supports Port=20 > IO in direct fast and indirect slow mode (the one the current=20 > LabVIEW PortIO functions support) and possibly low mem=20 > access, not multiplattform although I got a Linux example=20 > too, just need to adapt it a bit to get it working nicely=20 > with LabVIEW.) I hope I have it ready end of this week and=20 > then I'll look into the inherited pipe system exec if nobody=20 > else stepped up to it until then. >=20 > Rolf Kalbermatter >=20 OK, thanks. I've also pinged a TortoiseCVS developer (who is also an = OpenG Developer ;-) about this. I'm hoping to hear back soon. -Jim |
From: Jim K. <ji...@ji...> - 2004-03-05 19:02:49
|
Regarding TortoiseCVS and piping into Plink, here is a snip from an = email I got back from Ian: ########### My first take used the WinAPI file functions to read/write pipes = (ReadFile and WriteFile). I now see that the Tortoise project has now added POSIX calls for the non-Win32 interface. It might be possible to use POSIX = calls from msvcrt instead of Win32 calls from User32. Both chunks of code are in the link below (see the "run" function about two-thirds of the way down). I'll take a quick peek at using execvp() = from LabVIEW. <http://cvs.sourceforge.net/viewcvs.py/tortoisecvs/TortoiseCVS/src/cvsgui= /cv sgui_process.cpp?rev=3D1.7&view=3Dauto> ########### -Jim |