Subject: Re: Remote Terminal with iPhone SDK

Re: Remote Terminal with iPhone SDK

From: Peter Stuge <peter_at_stuge.se>
Date: Mon, 28 Jun 2010 12:56:54 +0200

Paresh Thakor wrote:
> Thanks for your kind reply... but you say that i am using libssh2
> in proper way that i don't think right.

Yes. The problem you are facing has nothing to do with libssh2. The
part of your program that *is* related to libssh2 is already working
correctly for you.

> Because i need to create a proper and complete terminal emulator
> and i resulted in simple UITextView based command/output system.

http://developer.apple.com/iphone/library/documentation/uikit/reference/UITextView_Class/Reference/UITextView.html

"The UITextView class implements the behavior for a scrollable,
multiline text region."

UITextView is completely useless as a terminal emulator.

> And i can't get what it PuTTY, i made some search on that but
> there's no proper answer for the suggestion.

The first hit on google.com is:

http://www.chiark.greenend.org.uk/~sgtatham/putty/
PuTTY: A Free Telnet/SSH Client

Surely you saw that? Study the source code. Learn about terminal
emulators. Also search for information about terminal emulators of
course, and study the material that you find.

Again, the first hit on google.com is:

http://en.wikipedia.org/wiki/Terminal_emulator

If you have problems even finding this quite basic information then
I would caution against continuing this project now. Terminal
emulators will cause you much more trouble.

> IF you know iPhone programming then suggest me something.

I don't.

> rc = libssh2_channel_request_pty( channel, "xterm"); This is my PTY
> function. I don't know what to use to display terminal so it looks
> like real termina.

In the function call you tell the server that you are xterm.
(xterm is one specific terminal program.)

Now the server will use the escape sequences that xterm understands.
In order to display the screen correctly you must interpret them in
your program. This is what a terminal emulator does. You can look at
the xterm source code, but xterm is very full featured and the code
is rather large, so it is not the best reference for a minimal
terminal emulator.

It seems that someone is already working on what you need. The very
first hit on google.com when searching for iphone terminal emulator
is:

http://code.google.com/p/mobileterminal/
mobileterminal
A GUI Terminal application for the iPhone

Integrate this with libssh2 correctly and you might be finished
already.

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