View Full Version : ssh using Socket API

11-10-2008, 08:19 PM
I have no experience with sockets so be gentle. Would it be possible to create a socket in an AIR application that uses SSH (port 22)?

For example:

var s:Socket = new Socket("", 22);

s.addEventListener(ProgressEvent.SOCKET_DATA, sData);
s.addEventListener(Event.CONNECT, connectHandler);

function sData(e:ProgressEvent):void
var d:String = s.readUTFBytes(s.bytesAvailable);
if ( d.indexOf("SSH-2.0-OpenSSH_5.0") != -1 )
// do something here but not sure what

function connectHandler(event:Event):void {
trace("ConnectHandler:" + event);

Just because I get the string "SSH-2.0-OpenSSH_5.0" returned, does that mean I am connected? Because my connectHandler() is not firing.

I have root access with the application to system, by the way.