Page 1 of 1
Communicating with remote application
Posted: Sun Oct 18, 2009 2:18 pm
by skindoc4
I run a Linux Web Server (Webmin). I want to be able run a Revolution Server Application on this Linux machine and be able to control it (ie. start it on the remote machine, exchange information with it and have it run commands, close it) from the Client RunRev stack via the internet and the LAN. I have a Server/Client application using sockets already running successfully on a local machine and over the LAN of a Macintosh only network. I have read and reread the User Guide and I know the answer is in there but I can't quite see it.
Can anyone assist?
Alex
Posted: Sun Oct 18, 2009 3:46 pm
by Mark
Alex,
What is the problem?
Mark
Communication with rmote application
Posted: Mon Oct 19, 2009 12:51 pm
by skindoc4
Hi Mark
I want to contol a console application (no desktop image) on a Linux machine. The application is the Server to my database which I want to be able to access over the Internet hence its location. My understanding of sockets is that the application must be running and listening for connections before communication can occur. I can see how to start applications on the local machine using launch or applescript but not how to do it on a remote Linux machine. I want to be able to turn it on or off remotely. Firstly I want to be able to do it across the LAN, later over the Internet.
Alex
Posted: Mon Oct 19, 2009 1:43 pm
by Mark
Dear Alex,
You can start any standalone by simply entering the path to the executable in the terminal. This works on Linux, not on Mac OS X. On Mac OS X, you need to use the open command.
The next logical step seemed to me to try to execute the command (path to the executable) remotely, using ssh, but this doesn't work because Revolution only works if a graphical environment is available (Xorg, X11, etc).
It is certainly possible to run an X server remotely over SSH. You can read an interesting article about that
here.
Probably, the easiest way to deal with this, for a Rev programmer, is to create one server application, which continuously listens on a particular port. Send commands to open and close programs to this server application and execute these commands using the shell function. You might use Revolution's built-in encryption features to encrypt the connection.
Best regards,
Mark
Posted: Tue Oct 20, 2009 3:56 am
by skindoc4
Hi Mark
You're a real brick. (= Australianese for "really good bloke", = Australianese for "very fine gentleman")

)
This list is terrific for part-timers like myself.
This is really good information - thank you so much for the pointers.
If you ever want to know some general medical information or specifically about skin cancer, just ask.
I'll do the last suggestion first then go and learn some Unix/Linux as I have been meaning to do for a while. I don't have Enterprise but I have instituted my own encryption protocol using sockets so I think I would use this to send the commands.
But - I think you are saying that I can't just load my Revolution stack onto the Linux machine and have it run because I don't have a graphical environment running?
Alex
Posted: Tue Oct 20, 2009 6:18 am
by mwieder
You can certainly build faceless applications for any environment in rev. I handle this in the preOpenStack handler:
check for commandline switches
process the commands
quit
If you need to, you can also build linux daemons this way (without the quit, obviously).
Posted: Tue Oct 20, 2009 8:44 am
by Mark
mwieder,
Have you tried executing a faceless application remotely, e.g. over ssh?
Best,
Mark
Posted: Tue Oct 20, 2009 4:21 pm
by mwieder
No, admittedly I haven't tried this over ssh.
But the -ui commandline option should allow operation without an X (or any othe graphic ui, for that matter) system available. My understanding is that Alex needs socket communications between the two systems and doesn't need a gui on the remote end. I may be wrong about that.
(btw : that's a good and clearly written article you linked to)
Posted: Tue Oct 20, 2009 11:10 pm
by skindoc4
mwieder,
thank you
You are correct - I don't need a GUI at the remote end as my idea is to administer my Server application remotely using sockets and encrypted messaging - I have this part of the system working across the LAN network of Macintosh computers. My software is designed for relatively low levels of traffic across a small network but with a need for some access via the internet. This way I can simulate a multiuser environment with a simple single user database, SQLite - makes distribution amongst some users who are part-time users of computers very easy.
However I needed to know 2 things about which I was unsure:
1) whether a Revolution stack compiled on a Macintosh could be simply dropped onto a Linux machine and have it run in a non-GUI environment
2) a way to remotely open a Revolution stack without a GUI on a Linux machine; once the application is open I can use sockets to do everything else.
I think what you and Mark have given me will be enough but please advise if I am wrong.
Alex
Posted: Wed Oct 21, 2009 1:39 am
by mwieder
1) whether a Revolution stack compiled on a Macintosh could be simply dropped onto a Linux machine and have it run in a non-GUI environment
2) a way to remotely open a Revolution stack without a GUI on a Linux machine; once the application is open I can use sockets to do everything else.
#1 is indeed possible. Compile the standalone for linux on a Mac, copy it over, and run it from a command line.
#2, as I mentioned, I haven't tried this over an ssh tunnel. I don't see why it wouldn't work, but Mark knows what he's doing, and if he says it didn't work for him, I'd take heed before you get too far into this thing.
Posted: Wed Oct 21, 2009 2:23 am
by skindoc4
Hi mwieder
command line looks easiest for the moment to get the programme running on the LAN but on the Linux machine. I don't know much about ssh but I shall certainly follow-up Mark's lead.
Alex
Posted: Sun Oct 25, 2009 1:07 am
by matthiasr
Hi,
i was looking also for a way to start an app (lets say app1) remotely, not on linux but on windows. The problem was that there was no vpn and ssh available due to security restriction. The machine, on which i wanted to start the app remotely was only -execpt the normal lan connections- able to use port 80 for internet connections.
1. solution:
I created an app (lets say app2) for this machine, which looks on the web in a special folder for a specific file. If the file is found, the file is deleted and app1 is opened. This app2 is run every 5 minutes. Another way would be to place commands e.g the path/name of the desired app into a text file. This would allow me to send different command to that machine.
2. If it is not possible to put such a file onto a webserver, i use twitter for that instead.
I have 2 twitter accounts, both are "private", so no one sees what i post.
On the machine, which should start the programm, i run in a loop a tool which connects to my twitter account#1 and looks, if there is a tweet from account#2. This is repeated every 5 minutes.
In this tweets i put the command, e.g. 'reboot' or 'remote control' and so on.My tool reads the new tweet and knows what to do. 'remote control' for example causes the remote machine to start a remote control program over port 80, so i can remote control this machine from my office.
I am using this for several of my customers, where i have to do remote control and no VPN connection is possible and no employee is there to start the remotecontrol manually. I use only one Twitteraccount for the tweets and one for each customer. In my Tweets i post : customername command. And on the customerside the tool just looks for tweets, which contain the name of this customer.
The most time i am using solution 1, but i use a file for each customer and i put the commands into the file. On the customerside i start the "check"-programm every 5 minutes from the commandline with the URL (to the file, which contains the command) as a commandline switch.
Regards,
Matthias