From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,8a39a73d0242ca42 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news.glorb.com!feeder.erje.net!news2.arglkargh.de!news.swapon.de!aioe.org!nospam From: "John B. Matthews" Newsgroups: comp.lang.ada Subject: Re: GNAT.Sockets. Blocking? Date: Tue, 23 Jun 2009 20:14:47 -0400 Organization: The Wasteland Message-ID: References: <158756da-21b7-4e2d-b288-7ba030f1f35c@25g2000yqb.googlegroups.com> NNTP-Posting-Host: ib4TTflHUauJidfWP/+Rjw.user.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.7.9 Cancel-Lock: sha1:fVrMIEpkD0l5RbmMZQLGBcHA/Ug= User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Xref: g2news2.google.com comp.lang.ada:6583 Date: 2009-06-23T20:14:47-04:00 List-Id: In article <158756da-21b7-4e2d-b288-7ba030f1f35c@25g2000yqb.googlegroups.com>, "Jacob M. H. Smith" wrote: > I'm kind of new to socket programming and I need some help here. I > wrote a simple little program that just fetches Google's index page. > The posted code works, but only because I used a "Connection: close" > header in the HTTP request. How would set up my code responsible for > reading the data from the stream so that I can read the page while > keeping the connection open? If I remove the header the program seems > to stop when calling the Ada.Streams.Read function if there is less > than BUFFER_SIZE data in the streams buffer. Can't I just read as > much as is available? [...] The Google page specifies "Transfer-Encoding: chunked", which must be "terminated by closing the connection." To get the whole page, I think you'd need to handle the chunk-size: Your code gets www.example.com correctly, without an explicit "Connection: close": -- John B. Matthews trashgod at gmail dot com