🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #3245

Re: i need ideas/comments with tclientsocket

#3245
From: Jonathan Benedicto
Date: Mon, 31 Oct 2005 19:00
32 lines
1962 bytes
Alfred wrote:
> now my data are stored in it and like you written I can read the
>        packet size with : int size = *(int*)Data->Memory;
> here is my new problem , for example : the first time I get only the
> first part of a package and after few seconds I get the last part of
> this  package. How I can join both parts ? my code now works but I
> haven't a single message, i have a lot of splitted message. thank you
> very much

Like this: (untested)

Data->Position = 0;

while( true )
{
    int MsgSize, SizeRead;

    SizeRead = Data->Read( &MsgSize, sizeof( int ) );
    if( SizeRead < sizeof( int ) )
        break;

    if( MsgSize > 0 )
    {
        AnsiString Message = AnsiString( (char*)( Data->Memory + 
Data->Position ), MsgSize );
        // Process message here.

        Data->Seek( MsgSize, soFromCurrent );
    }
};

Jonathan
Technical Details
Message-ID: <436669aa$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <43662baf$1@newsgroups.borland.com> <43664511@newsgroups.borland.com> <4366672a$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,5c33b8c6a9ca7fdb
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Jonathan Benedicto" <incorrect@no.server>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <43662baf$1@newsgroups.borland.com> <43664511@newsgroups.borland.com> <4366672a$1@newsgroups.borland.com>
Subject: Re: i need ideas/comments  with tclientsocket
Date: Mon, 31 Oct 2005 14:00:02 -0500
Lines: 34
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 69.158.116.150
Message-ID: <436669aa$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1130785194 69.158.116.150 (31 Oct 2005 10:59:54 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail