Re: [Ssh-sftp-perl-users] Using Net::SSH2 as a file handle
Brought to you by:
dbrobins
From: David R. <dbr...@cp...> - 2006-01-21 02:44:50
|
On Friday January 20, 2006 09:22, Bryan Bueter wrote: > > > > Ah, then there's the problem. Fileno tries to get a real Unix filehandle > > out > > of the object; since it isn't a real Unix file, you won't get one. > > > > Maybe something can be worked out with pipes so that it really is a handle > > (create a pipe, send the channel data to one end, give expect the other > > end) > > but it's beyond the scope of the current implementation. > > Ok, forgive me if my ignorance misses something here. > > Why not just implement channel as a real filehandle? You would still do > everything as is, but only now you could create a shell, then print things > directly to and read things directly from it. Because it's not a real file. It's a stream multiplexed over an encrypted socket connection formatted by the ssh protocol. If you read the raw socket you'd get ssh frames and encrypted data. > Which begets the question: What AM I to do with a shell created by > $chan->shell() ? Do I have to keep polling this to know when I can write > to it? I havnt been able to do much with this other then print out the > first couple of lines after it connects. Printing directly to it and/or > execing on top of shell doesnt seem to produce any more output then that. You don't exec on top of shell - exec is like exec(2) and doesn't let you run subsequent operations. When you have a shell channel you can send it commands and read back the responses using the standard I/O commands in Net::SSH2::Channel (or with filehandle ops using the tie). > An example might be handy, and/or some further documentation. If you get a chance to write one please submit it for inclusion. Thanks, -- Dave Isa. 40:31 |