0

Let's say I have a website written in PHP. A user downloads a C++ console program from the website and installs it on their computer. Now, I want to be able to printf() strings from my PHP website (the server) to the C++ console programs (the clients). I have thought of using REST by serving XML file such as:

<prints> <print>Text</print> </prints>

The advantage of REST is it's ease of use. The disadvantage is the C++ program has to constantly download the XML file. Would this be a problem if the user has a limit on their internet usage?

Another solution is sockets which eliminate the issue above, but, they are more complicated and they may be blocked by firewalls/routers.

My question is: Will downloading the XML file from the web server create a problem if the user has a limit on their internet usage? Also, is there a compromise between REST and sockets or is there an alternative to this type of communication?

2
  • REST does not require a constant connection. It is request based just like a web server. You make a request you get a response. Commented Mar 16, 2011 at 22:23
  • Downloading XML will (or won't) create a problem for your user depending upon the size of the XML relative to their bandwidth cap. If your empty document is small (for example, 0-1K bytes per 60 seconds) relative to their cap (ex. 250MB / day), then they probably won't complain. As with any optimization, measure the actual numbers to be sure. P.s. REST architectures don't require XML. A text (or JSON or CSV or, ...) file would work equally well. Commented Mar 16, 2011 at 22:54

1 Answer 1

1

HTTP is a protocol used to access websites.

Sign up to request clarification or add additional context in comments.

4 Comments

Yes, Hyper Text Transfer Protocol is a protocol used to access websites. May I respectfully ask how is this an answer to my question?
I think what he's trying to say is that a web service is the most simple, straight-forward and sane way to operate here. If you're worried about bandwidth use, then find a way to deliver only changed data to the client when it polls.
That's my question, I need a way to deliver only changed data to the client.
That wasn't apparent from your question text. What data are you working with here? You've only told us it'll be strings, and that's on the vague side of things. When does the data change? What causes it to change? Does it change based on the user, or is the same data used by everyone?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.