Jump to content
  • Advertisement

Archived

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

Skibum

Read a webpage - C++

This topic is 5522 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
One solution is winsock.

I highly recommend Network Programming for Microsoft Windows, Second Edition by Anthony Jones and Jim Ohmund.

Kuphryn

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
why doesn't anyone mention the obvious one-line-of-code solution?

URLDownloadToFile.

[edited by - niyaw on March 6, 2003 4:23:18 AM]

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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!