On Sunday 03 February 2013 17:05, in comp.os.linux.development.apps,
[snip]
>
> *Question*: Is it possible to know the size of the page to download
> beforehand?
Yes, and no.
If you first converse with the HTTP server using a HEAD method, you will
get, in the response, a "Content-Length" tag which will tell you how big
the content is. The problem is that this is still a TCP conversation, and
will have the same "response size" issue that you currently have, but for
it's own response. In other words, you will *not* know how big the server's
response to your HEAD request will be beforehand, and will only be able to
detect that you've received it all by encountering the termination of the
conversation.
If you send a GET method instead, you will get both the response headers
(including the "Content-Length" header) /and/ the data contents.
In either case, you *must* interpret the data you receive from the server to
determine how big the response is going to be.
> Or is then any other way how I can solve the recv() hanging
> issue?
Is there any reason you can't use already existing utilities to fetch the
page /as a file/, and then perform post-processing on that file? If not,
then why not just use wget(1) (or similar) to retrieve the XML into a file,
and then process the file without worrying about the HTTP protocol?
HTH
--
Lew Pitcher
"In Skills, We Trust"