Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > How to use Net::SSH for piping?

Reply
Thread Tools

How to use Net::SSH for piping?

 
 
Ilmari Heikkinen
Guest
Posts: n/a
 
      12-04-2005
Hi, I've got a bit of a problem here.

Here's the setup, I'm proxying a remote command through a unix socket:
1. Started an SSH session to a remote host using Net::SSH
2. Created an UNIXServer and now am accepting connections
3. A new connection arrives
4. Want to pipe the connection's out to a remote commands' in, and vice ver=
sa
Preferably using a new SSH channel and not a whole session.

E.g. the remote command would be `lame - -`, encoding wav files to mp3,
and then I would pipe a wav to the proxy and get an mp3 out like this:
`socat - UNIX-CONNECT:local_socket < my.wav > my.mp3`

What's the correct way to do the piping to the command and back with Net::S=
SH?

Thanks in advance,
Ilmari


 
Reply With Quote
 
 
 
 
Ilmari Heikkinen
Guest
Posts: n/a
 
      12-04-2005
> Here's the setup, I'm proxying a remote command through a unix socket:
> 1. Started an SSH session to a remote host using Net::SSH
> 2. Created an UNIXServer and now am accepting connections
> 3. A new connection arrives
> 4. Want to pipe the connection's out to a remote commands' in, and vice
> versa
> Preferably using a new SSH channel and not a whole session.


I went with using IO.popen("ssh #{host} #{create_proxy_script_for(filename)=
}")
for now, couldn't figure out how to do it with Net::SSH
(session.process.popen3 lacked .close_write, and trying to send data
in a blocking fashion with process.open took too much hacking of the
library internals (and I couldn't get it working in the end))

Oh well. It's slow and cumbersome, but at least it works in the
interim. Need to figure out a better way at some point.


 
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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Could not use ''; file already in use. M K ASP .Net 11 04-09-2008 11:35 AM
where to use CPLD & where to use FPGA? kulkarku@math.net VHDL 6 03-06-2006 07:27 AM
Can I use XPath or something to a remote Mac or Linux box and just query an xml file, not using web services and use encyrption? jake ASP .Net 0 07-06-2004 02:16 PM
Cannot use the profile "default" because it is in use, not. please.post@yur.re.ply Firefox 1 07-04-2004 03:41 AM



Advertisments