Archived

This topic is now archived and is closed to further replies.

Skibum

Read a webpage - C++

Recommended Posts

I''m looking for a way to read a webpage and save it to a file. I would also need to be able to read binary data off of webpages and save it to disk. How can this be done without using MFC on a windows box? Using Visual Studio 6.0 on Win98. -Skibum

Share this post


Link to post
Share on other sites
Here''s a link containing source code from the book "Winsock 2.0" by Lewis Napper. One of the examples should be grabbing a file from an HTTP server.

http://www.sockaddr.com/ExampleSourceCode.html

Share this post


Link to post
Share on other sites
See ACE

- Magmai Kai Holmlor

"Oh, like you''ve never written buggy code" - Lee

[Look for information | GDNet Start Here | GDNet Search Tool | GDNet FAQ | MSDN RTF[L] | SGI STL Docs | STFW | Asking Smart Questions ]

[Free C++ Libraries | Boost | ACE | Loki | MTL | Blitz++ | wxWindows| Spirit(xBNF)]
[Free C Libraries | zlib ]

Share this post


Link to post
Share on other sites
quote:
Original post by kuphryn
I highly recommend Network Programming for Microsoft Windows, Second Edition by Anthony Jones and Jim Ohmund.
Kuphryn


Despite being the most expensive book in the store; it would be much better if the author(s) didn''t assume you...

ALREADY KNEW EVERYTHING!!!

Sorry. I feel I need to make it clear that you shouldn''t try to make the same mistake I did.

If you don''t already know absolutely everything there is to know about networking programming, this book is not for you.

Share this post


Link to post
Share on other sites
After successfully calling a GET and retrieving the result does the socket need to be closed? I''m downloading 2 webpages from a server one after another and the second call is giving me an error on the recv with an error of WSAECONNRESET. If, however, I close the socket and open another it works fine.

Share this post


Link to post
Share on other sites
That''s part of the HTTP protocol, HTTP 1.1 does let you use persistent connections (I forget how to request that), but HTTP 1.0 you''ve got to connect, make your request, the server sends its response, you close the connection. Then you open a new one for the next request and so on.

Share this post


Link to post
Share on other sites