🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Indy 9 to Indy 10 Changes....

#934
From: Paul at NCF
Date: Sat, 08 Sep 2007 08:40
52 lines
2402 bytes
Just had some time to try rebuilding Indy 10 again, and just want to clarify 
the new event handler parameters for IdUDPServer.  Got most things compiled 
now and just the following to ask.

The IdUDPServer class has the following read event:
    TUDPReadEvent = procedure (Sender: TObject; AData: TIdBytes; ABinding: 
TIdSocketHandle) of object;

So from Indy 9 to 10:
    void __fastcall IdUDPServerUDPRead(TObject *Sender,TStream 
*AData,TIdSocketHandle *ABinding);
to
    void __fastcall IdUDPServerUDPRead(TIdUDPListenerThread* AThread, 
TIdBytes AData, TIdSocketHandle* ABinding);

In my Indy9 read event handler it looks like the following, the read event 
handler reads data from the stream until there is nothing more to read, exit 
loop, then process whats been received.  What I want to know is how this 
changes with Indy 10 and the TIdBytes parameter?  TIdBytes appears to be be 
a byte array wrapper, which doesn't seem the same as a TStream.

Regards,

Paul
----

    try
    {
        int BufSize = AData->Size;
        int BufIndx = 0;
        char * Buf  = RxBuf->Udata;
        bool result = false;

        while (BufSize > 0)
        {
            int iRead = 0;

            iRead = AData->Read( &Buf[BufIndx], BufSize );

            if( iRead > 0 )
            {
                // success
                BufIndx += iRead;
                BufSize -= iRead;
                result = true;
            }
            else
            {
                // fail
                BufSize = 0;
            }
        }
Technical Details
Message-ID: <46e26004$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,572c0d764f6305dd,start
X-Google-Attributes: gid11508e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Paul at NCF" <notplmacca@clara.co.uk>
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: Indy 9 to Indy 10 Changes....
Date: Sat, 8 Sep 2007 09:40:34 +0100
Lines: 54
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138
NNTP-Posting-Host: 81.129.105.176
Message-ID: <46e26004$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1189240836 81.129.105.176 (8 Sep 2007 01:40:36 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail