I’m looking to use a web service that offers a streaming api. This api can typically be used by the java method java.net.URL.openStream();
Problem is I am trying to design my program in C++ and have no idea what libraries (I’ve heard the cUrl library is very good at this sort of thing) to use, or how to use them to do what I want.
The idea is that after opening the file as a stream I can access continually updating data in realtime.
Any help would be much appreciated.
Boost.Asio socket iostreams seem to be what you’re after. Your code will look like this:
If you’re new to C++ and have no experience with iostreams then this page is an excellent source of information. In particular, check the docs of the
istreamclass to see what kind of operations your Boost.ASIO stream will support.You’ll find that they’re not so different from those in the Java IO API.EDIT:
Eric is right, you’ll have to send some requests to the server (using the same stream) so it’s probably less similar to Java’s
openStreamthan I thought. The following example shows how to make those requests:http://blog.think-async.com/2007_01_01_archive.html