🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Indy 9 to Indy 10 Changes....

#788
From: Remy Lebeau (TeamB)
Date: Mon, 10 Sep 2007 18:08
38 lines
2055 bytes
"Paul at NCF" <notplmacca@clara.co.uk> wrote in message
news:46e26004$1@newsgroups.borland.com...

> What I want to know is how this changes with Indy 10 and
> the TIdBytes parameter?

TIdBytes has a Length property.  That will tell you how many bytes are
available.  It also has a '[]' operator, so you can access the individual
bytes just like with any other kind of array.  Which in fact will simplify
your event handler code, because you won't need a temporary buffer anymore.
You can use the TIdBytes as-is:

    void __fastcall IdUDPServerUDPRead(TIdUDPListenerThread* AThread,
TIdBytes AData, TIdSocketHandle* ABinding)
    {
        try
        {
            // assuming Udata is large enoughto hold all of the bytes, of
course...
            memcpy(RxBuf->Udata, &AData[0], AData.Length);
        }
        //...
    }

> TIdBytes appears to be be a byte array wrapper, which
> doesn't seem the same as a TStream.

No, it is not the same.  If you look at the declaration of TIdBytes in
IdGlobal.hpp, you will see that it is a typedef for the VCL's DynamicArray
templated class:

    typedef DynamicArray<Byte> TIdBytes;

DynamicArray is documented in BCB's help files.


Gambit
Technical Details
Message-ID: <46e58841$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
References: <46e26004$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,572c0d764f6305dd
X-Google-Attributes: gid11508e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <46e26004$1@newsgroups.borland.com>
Subject: Re: Indy 9 to Indy 10 Changes....
Date: Mon, 10 Sep 2007 11:08:03 -0700
Lines: 40
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 75.83.29.61
Message-ID: <46e58841$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1189447745 75.83.29.61 (10 Sep 2007 11:09:05 -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