Open Side Menu Go to the Top
Register
How to run software as a server, embedded How to run software as a server, embedded

07-25-2016 , 10:02 AM
Hey guys,
I recently wrote a small poker program for heads-up play.

My goal now is to enhance this software to run as a server on a micro controller. Therefor i compiled the program via CMake on my raspberry.

Does anyone have an idea how to run this on the PI's IP in my local network?

Thanks in advance
How to run software as a server, embedded Quote
07-25-2016 , 10:11 AM
Same way you'd run it anywhere else? The Raspberry Pi is just a normal linux-based computer.

This is one of those fake questions, isn't it?
How to run software as a server, embedded Quote
07-25-2016 , 12:46 PM
Ehm no tbh, now i feel fkn stupid =D

To be sure we are on the same topic:

I want to run the software on the raspberry, then connect to it via 2 devices in the same network via its IP
How to run software as a server, embedded Quote
07-25-2016 , 04:09 PM
OK? Then do that.

I mean, do you know how to do it on a normal non-raspi computer? It'll be the same thing.

This isn't really answerable without knowing how your program runs or whatever, but there's not really any difference between sockets on a raspi than on a regular linux computer.
How to run software as a server, embedded Quote
07-25-2016 , 04:21 PM
I feel really confused. Does your program already "run as a server?"

If not, then what specifically do you mean by "run as a server?"
How to run software as a server, embedded Quote
07-25-2016 , 04:24 PM
Well at first thanks for trying to help me

Since this is my first time asking for help on the internet I need to learn how to specify my questions when asking.


I have written a program that compiles under Linux. For now though only on my computer, and it is not possible to connect to that program whatsoever.

My plan is to modify this software in a way so that it runs as a server on a certain IP in my local network (via PI). I don't have any idea on setting a server (or a similar stucture) up and this is what I am asking here. The program is written in C++.

Hope this outlines my problem, thanks in advance
How to run software as a server, embedded Quote
07-25-2016 , 05:10 PM
Ah, OK. Well, you have some learning ahead of you, this is not a simple question to answer as such.

How to accomplish what you want depends a little bit on exactly what you want to do. There is not a single meaning for the term "run as a server"

For example, you could run a webserver, and when requests come in to the webserver, it runs your program and returns the output as a web response.

Or you could have your program run as a socket, accepting connections on a specific IP and port - this is probably what you mean but not the simplest thing to get working. Once you've done it a few times it's pretty simple but in my experience of teaching people to program, it takes a few tries to get right.

You could also have both your "server" and your "client" connect to a remote 3rd party and communicate via that. For example I used to write servers and clients that talked to each other over IRC, or MSN, or ICQ, or even my own chat protocols.

How do you plan to connect to the your server, once it's running? Web browser? Custom client program? Something else?
How to run software as a server, embedded Quote
07-26-2016 , 12:18 AM
Running the program as a socket sounds exactly like what I was looking for.

I was working with a software called FHEM recently. Once installed one your PI, its interface is accessible via 192.168.XX.XX:XXXX, if your in the same network only obv.

So i thought of something like that, access through Web browser.
How to run software as a server, embedded Quote
07-26-2016 , 04:20 PM
OK, well, if you want to access it through a web browser, then you pretty much need to make it available through a webserver. There are really like a million ways to do this. It kinda depends on what languages you like. Like, if you like python then maybe use Flask or Django. There's Ruby on Rails, etc. Apache with perl or PHP. You can do it all with C++ but you'll find that harder, probably.
How to run software as a server, embedded Quote
07-26-2016 , 09:51 PM
I'd opt with changing your code to Python and run it as a webservice with Flask (like RustyBrooks said). It's pretty lightweight and it'll get the job done.
How to run software as a server, embedded Quote
07-27-2016 , 02:33 PM
Thanks for your ideas guys!

Im prolly not gonna change the entire code to python since its a fkload of files and I'm not that great with anything besides C.
So ill look for a webserver tool that works with C++

Again your time and ideas are appreciated, if I happen to finish the entire project i can share it with you, if wanted
How to run software as a server, embedded Quote
07-27-2016 , 02:34 PM
You don't need to change the code to python. You'd just use, say, a python based webserver to accept web requests, and it would run your program either by executing it, or if you want to get fancy, as a library. I could probably make a simple example if you're interested.
How to run software as a server, embedded Quote
07-29-2016 , 01:47 AM
Well if it wouldnt take you too much time...

But its not super important! I can also just learn some webserver tool that works with C
How to run software as a server, embedded Quote

      
m