Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Network remote control
Network remote control [message #46544] Sun, 22 May 2016 10:26 Go to next message
Infausto is currently offline  Infausto
Messages: 28
Registered: June 2008
Promising Member
I want to know what is the best approach to remotely control an app using network.

My first idea was use Skylark to serve a webpage that sends command back to the server, and reacts accordly. But it seems quite hard to mix a GUI app with Skylark. There is no documentation nor example for that.

Mi second idea was to use some kind of RPC, but that seems to overbloated to do something that simple.

I review ZMQ but has no event mechanism... Using polling in 2016? Very crusty, i think.

Any other ideas?
Thanks in advance.

Re: Network remote control [message #46546 is a reply to message #46544] Sun, 22 May 2016 13:27 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi Infausto

Using Skylark and GUI together seems to become an FAQ Smile I already tried to figure out an answer a while back, when someone else asked, see this thread from 2012. Some hints might be also in this one from 2013.

Aside from the skylark solution, there is many other more or less hacky ways to remotly control an application. You could for example use simple http server (e.g. nginx) to upload files with instructions to machine where the application runs. The application would then just monitor the location for new files and interpret the commands (using e.g. inotify, if you want to avoid polling). This would be quite a lot of a hack, but really easy to do.

Or, less hackish one: you can simply create a thread listening on specific port and pass the commands to gui thread using callbacks.

Best regards,
Honza
Re: Network remote control [message #46560 is a reply to message #46544] Sun, 29 May 2016 21:16 Go to previous messageGo to next message
Zbych is currently offline  Zbych
Messages: 325
Registered: July 2009
Senior Member
I created an application mixing GUI and skylark in single binary.
Skylark passes callbacks to GUI to change some settings (callbacks must be declared static/global).
GUI prepares some data to be shown by skylark in advance and stores them as static/global variables protected by mutexes.

Now I am thinking about using web sockets to update content of pages generated by skylark without page refresh.

Re: Network remote control [message #46597 is a reply to message #46560] Mon, 06 June 2016 20:37 Go to previous messageGo to next message
Infausto is currently offline  Infausto
Messages: 28
Registered: June 2008
Promising Member
Hi Zbych, many thanks for your post.

Can you provide a very simple sample of your integration of GUI app with Skylark?

About using Websocket: My solution for implement a network remote control was use a separate web server for static files, and use a websocket sever inside the GUI app for receive the commands from clients. Now i want to replace the external webserver by an Skylark instance inside the GUI app, but i need help to do that.

Can you provide a very simple sample of your code to achieve that?

Many thaks in advance.


PS: I have issues with the websocket server because i don't know how to terminate his thread when GUI app is finished. The app is indeed terminated, but with an horrible last window message "Heap leaks detected" (generated by MSVC compiler in debug mode), and of course that have leaks, because the main thread is finished, but not the websocket one.
Re: Network remote control [message #46600 is a reply to message #46597] Tue, 07 June 2016 21:23 Go to previous message
Zbych is currently offline  Zbych
Messages: 325
Registered: July 2009
Senior Member
Infausto,

I attached simple example. It probably will not compile on Windows due to signal handling, but I have no time test it on Windows.

[Updated on: Tue, 07 June 2016 21:24]

Report message to a moderator

Previous Topic: errors re strings
Next Topic: ProtectServer and SMTP setting
Goto Forum:
  


Current Time: Thu Mar 28 10:02:00 CET 2024

Total time taken to generate the page: 0.01399 seconds