Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.development.apps > #576
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.straub-nv.de!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Rainer Weikusat <rweikusat@mssgmbh.com> |
| Newsgroups | comp.os.linux.development.apps |
| Subject | Re: Program hanging on recv() |
| Date | Mon, 04 Feb 2013 19:43:19 +0000 |
| Lines | 24 |
| Message-ID | <87bobzj25k.fsf@sapphire.mobileactivedefense.com> (permalink) |
| References | <kem9lq$ir1$1@dont-email.me> <871ucxoz78.fsf@araminta.anjou.terraraq.org.uk> <kemmvd$nd5$3@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| X-Trace | individual.net hBIEucrcr+V356H9jEqyLwiWGiS7B09/SR3DPXXhuo6SFQIUrZYrMldbSEzh58flg= |
| Cancel-Lock | sha1:AO3mmWSbH+YqIA6oiQrbk9YdMd0= sha1:bj4nCHcosDg4rsL2DRvFQdVXs80= |
| User-Agent | Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) |
| Xref | csiph.com comp.os.linux.development.apps:576 |
Show key headers only | View raw
Ramon <ramif_47.invalid@yahoo.co.uk> writes:
> What I'm actually doing is just downloading an XML page to memory
> using the HTTP
> protocol. (e.g. http://weather.yahooapis.com/forecastrss?w=2502265)
[...]
> *Question*: Is it possible to know the size of the page to download
> beforehand?
If you're only interested in using the TCP connection for a single
request-reply exchange, send a HTTP1.0 request without a Connection:
header or with Connection: close as connection header and call
shutdown(sockfd, SHUT_WR) on you socket after sending the complete
request. The server is then required/ supposed to mark the end of the
reply by closing the connection so you can just read until EOF.
Otherwise, there are (AFAIK) two additional cases to deal with:
- length of the content is provided in form a a Content-Length
header
- so-called 'chunked transfer coding' (reply is send in chunks
each of which is preceded by a chunk length)
Back to comp.os.linux.development.apps | Previous | Next — Previous in thread | Find similar
Program hanging on recv() Ramon <ramif_47.invalid@yahoo.co.uk> - 2013-02-03 19:18 +0100
Re: Program hanging on recv() Richard Kettlewell <rjk@greenend.org.uk> - 2013-02-03 21:38 +0000
Re: Program hanging on recv() Ramon <ramif_47.invalid@yahoo.co.uk> - 2013-02-03 23:05 +0100
Re: Program hanging on recv() Lew Pitcher <lpitcher@teksavvy.com> - 2013-02-03 17:50 -0500
Re: Program hanging on recv() Richard Kettlewell <rjk@greenend.org.uk> - 2013-02-03 23:16 +0000
Re: Program hanging on recv() Jasen Betts <jasen@xnet.co.nz> - 2013-02-04 11:10 +0000
Re: Program hanging on recv() Ramon <ramif_47.invalid@yahoo.co.uk> - 2013-02-04 21:21 +0100
Re: Program hanging on recv() Rainer Weikusat <rweikusat@mssgmbh.com> - 2013-02-04 19:43 +0000
csiph-web