Shell ssh connection time out?

I’ve been using this code to try and create a secure ssh tunnel using plink with the Xojo shell in WIndows. The commands work fine if I run them manually from a command prompt but when I try to execute via the Xojo shell s.Result says ‘shell timed out’ over and over. Anybody know what I’m doing wrong? Thanks!

dim strTest As String strTest = chr(34) + strAppPath + chr(34) + "plink.exe -ssh -v -L 7777:127.0.0.1:3306 myuser@mydomain.com -pw myPass -P 22" Dim s As Shell s = New Shell s.TimeOut = 10000 s.Execute(strTest) WriteStatus s.Result

  1. what mode is the shell ? you need one that is going to persist & not just exit right away
  2. make sure your shel doesn’t go out of scope as that will close it

I tried s.Mode = 2 which I read in another post was the way to go but I just get a flashing cursor. It doesn’t time out but it doesn’t display any of the verbose messages it should and when I try to execute a mySQL command it’s not connected. Any advice would be appreciated I’ve been at this for a while now. Thanks!

I got it to work using the interactive shell example in the Xojo examples. I’ll look through the code and see what I was doing wrong. Thanks!

Norman can you tell me what the best practice is for opening and closing these SSH connections? Should I close the connection after each MySQL query and then open a new connection for the next query? Or should I just leave the app connected until it closes?

Setting up then tearing down the ssh connection might be time consuming & could be slow thereby making your app feel slow.
But its really going to depend on your app and how frequently you access the DB.
If it’s high traffic then leaving it up makes sense.
But that’s something I can’t really judge as it will depend on your usage model.

It’s a server type app for mobile devices to connect through so it would be considered high traffic. Thanks for your input I appreciate it very much.