Subject: Re: Remote Terminal with iPhone SDK

Re: Remote Terminal with iPhone SDK

From: Peter Stuge <peter_at_stuge.se>
Date: Wed, 14 Jul 2010 22:47:00 +0200

Hi again,

Paresh Thakor wrote:
> After close inspection and debugging methods, we've come to know that
> the application doesn't use libssh. It uses built-in terminal (TTY)
> through files. Like, dumping all commands and o/p in a file.

The terminal emulator is a very significant piece of code and it is
the only thing that solves your problem. Use mobileterminal or
another terminal emulator that fits your environment.

> And the code is written with fully integration with other classes,
> so, generally very time consuming to get it work for our application.

Re-purposing the terminal emulator in mobileterminal is *surely*
*much* less time consuming than implementing your own terminal
emulator.

> I tried to use libssh2 for the application with a try. But not able
> to parse the output because output in mobile terminal comes from
> dumped file which is not the case for libssh2.

So what? You have the source code, write some glue that connects the
two together. Forget about the files. The terminal emulator part of
mobileterminal is the kind of code that you need to solve your
problem.

> i've tried to decode o/p from libssh2 command execution but not
> very easy to make it done.

Of course the output does not come from libssh2 - SSH is a clean
transport that never influences the data being sent.

It is difficult for you to decode output from commands which expect
to be connected to a terminal, because you are not a terminal, and
because you are not using a terminal emulator.

Use a terminal emulator, whose purpose is to understand the output
from commands that expect to be connected to a terminal.

> libssh2 command execution as it's because it's working in my
> application.
 Just trying to reuse the decoding functionality for the app, so, i
can make the o/p to be displayed on the screen (UIView).

UIView is most likely completely useless as a terminal widget. My
guess is that you would get the best result from using mobileterminal
or another complete terminal emulator which is already implemented on
your platform.

> Could you please suggest me something so i can reuse for my
> application?

No I can not! Why should I? I have no iPhone and I don't develop
iPhone apps. This is the libssh2 mailing list, not a mailing list
about terminal emulators for the iPhone.

I did one search on google.com looking for a terminal emulator for
iphone and I found the mobileterminal project *immediately*. It looks
to me like mobileterminal solves the bulk of your problem. What
remains is for you to produce some glue code between the terminal
emulator and libssh2.

Obviously you did not bother to do the same search.. I'm sure you can
understand that this makes me very unmotivated to help you any
further.

> I am somewhat stuck with the application, due to VI and nano
> editior commands and top command as well..!

Too bad. You need a terminal emulator, mobileterminal looked like a
good fit, but if you are unable to use it then you should of course
search for an alternative. This mailing list is not a good place to
search, since this mailing list is about the libssh2 project, which
really is quite independent from terminal emulators.

Good luck.

//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-07-14