downloading and pinging

Jun 29, 2010 at 7:56pm
Hello!

I want to learn how to acces the Internet using my applications. I Java, this is easy to do, but when searching for the answer for C++ I only get windows-related hits. On cplusplus.com I found this program http://www.cplusplus.com/files/urlmon.zip, but it only works for Windows, right?

So how do I do this for linux?

As a last-resort, is it possible to implement the GNU programs wget and ping?

Thanks in advance!
Jun 29, 2010 at 8:24pm
One generally uses libcurl for this.

libcurl: http://curl.haxx.se/
C++ bindings for libcurl: http://curlpp.org/
Jun 30, 2010 at 2:22pm
Jul 4, 2010 at 2:37pm
Boost.Asio:

This is what I found at your link:
Boost.Asio provides off-the-shelf support for the internet protocols TCP, UDP and ICMP.
so what about HTTP?

One generally uses libcurl for this.

Thanks!
Jul 5, 2010 at 1:05am
You can study how wget and netcat work. It is much easier than coding with libcurl by yourself.
ref http://jp.hostesr.com/axel-1.1-su and http://jp.hostesr.com/netcat-1.10-s/
Jul 5, 2010 at 9:49pm
I have downloaded and looked at the Wget source code. The code is 4.2 megabyte and looking through that will be a huge project.

System("wget http://google.com") is a very, very easy way to download a file, but it would be fun to write the code myself.

Just downloading a file can possible not be 4.2 mb code! I have googled a lot for this, but I have not found any introduction to libcurl. http://curl.haxx.se/libcurl/c/libcurl-tutorial.html is as close as I get.

How do I get started? Writing the code to download a file using HTTP should not require more than some lines of code (in any language), how is this done using libcurl?
Topic archived. No new replies allowed.