Advertisement

HTML to C++

Started by May 01, 2015 09:12 PM
1 comment, last by Sik_the_hedgehog 9 years, 6 months ago

I don't know a whole lot about web servers, so I'm wondering if this is possible:

This would be a normal setup, I don't know the finer details but the web server can create real sockets to the local c++ executable, so that it can talk to some real time applications that exist on another machine. So in this example I have 3 machines: phone, PC-webserver, PC application


[ PHONE]                   [ PC   ]                                   [ Real-Time Application Machine 1,2,3...n]

[ html5   ]---html/js--> [Web Server]                                                                  |
                              |                                                                        |
                          [c++ executable] <-------real-time-socket-connection---------------> [ c++ executable] 

Could I possibly do something like this?


[ PHONE]                     [ Real-Time Application Machine 1,2,3...n]

[ html5   ]<--html/js--------->      [ c++ executable]

                          

Assuming I have all the html/webpage files on the phone, and when I click buttons they send HTML commands to an IP address (just like a normal webserver), only the "server" is actually my c++ application and I just attach data to my Get/Set/Request whatever HTML protocol command, and my c++ program can determine what to do with the data, and also send data back.

I'm not sure if there would be a better way or there is a library to do this or any pitfalls of something like this. I basically want a phone or PC, to be able to open a webpage to control a real-time c++ application that runs on another machine. The real-time PC is Linux so I don't know how well it could host the web server if I really needed one, but I still think it would be ideal to not have to have a web server to do this.

NBA2K, Madden, Maneater, Killing Floor, Sims

Yes. This is fairly common in older "comet" poll-based HTTP application servers.
Another option is to use websockets on the application side, and implement a websocket server in C++ (or whatever your preferred server-side language is.)
enum Bool { True, False, FileNotFound };
Advertisement

If you make the C++ program respond to an IP address visible to your machine, yes it's doable. Just connect to that address.

EDIT: er wait the program is on another machine? Screw that, you're basically asking for the most common server operation in existence. Just make sure there's an address to connect to and you're set.

Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.

This topic is closed to new replies.

Advertisement