Re: Socket read problem

From: Barry Margolin (barmar_at_alum.mit.edu)
Date: 08/29/04


Date: Sat, 28 Aug 2004 21:48:36 -0400

In article <Ip9Yc.12804$CV.11677@newssvr27.news.prodigy.com>,
 "Fletcher Glenn" <fandmgiiNOSPAM@pacbell.net> wrote:

> "Matta" <matta@use.net> wrote in message
> news:pan.2004.08.28.09.16.42.495384@use.net...
> > rdata = "";
> > do {
> > rdata += net_recv();
> > } while (rdata.substr(rdata.length()-5, 5) != "\r\n.\r\n");

>
> You cannot expect data to be neatly delivered in separate strings. The
> socket is a pipe. Message boundaries are strictly arbitrary, and you might
> receive several messages in a single read, or you might just receive a
> fragment of a message.

He seems to be handling that issue properly. NNTP::get_article() calls
NNTP::net_recv() in a loop, appending what it gets to the rdata string,
as shown in the portion of the code I quoted.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***