-
Socket program doubt
Hi folks,
I am a beginner in Socket Programming. I am trying to do some simple stuff but had a basic query.
I would like to implement something similar to wget in C using TCP sockets (i.e., without using any HTTP libraries). Just give a URL (Example-- $wget www.foo.com/bar.pdf) through command line, construct a HTTP GET request to download the file identified by the URL, and download and save file.
Right now trying this only for static HTTP content, but later want to modify for crawling entire site.
Can someone point out how to begin? What are the steps involved?
Thanks in advance.
G
-
May I ask why you'd bother reinventing the wheel when there are options like libcurl out there?
-
Well C won't do that without a lot of code on your part.
To match your description of the work you want to do, you need something like cURL and libcurl
If you really want to roll your own everything, then read "beej"
-
I just need to do it without using the HTTP libraries...
-
No problem - just read beej to figure out how to open a network connection.
Then read this to figure out what it all means.
Hypertext Transfer Protocol -- HTTP/1.1