🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: UDP.Broadcast corupted

#30
From: Remy Lebeau (TeamB)
Date: Thu, 07 Aug 2008 16:24
61 lines
2700 bytes
"jvdn" <geen@geenmail.com> wrote in message 
news:489aff67@newsgroups.borland.com...

> when I call the first function the data is still correct :
>
> here are the bytes from the debugger:
> 0   1   2   3  4   5
> [3][2][8][1][0][\0]

Are you viewing the TIdBytes or the original String?  TIdBytes is not a 
null-terminated data type, but the Debug Inspector may be trying to display 
it as such.  That does not mean the TIdBytes itself is corrupted.

> When I debug the code inbetween  I see Indy says that the
> langth = 5 repeatedly.

As long as the Length is being reported accurately every time, then all is 
fine.

> But I never see Indy put a end of string marker in the array.

It is not supposed to.  That is not how TIdBytes works to begin with.

> that is also the problem.

No, it is not.

> the ToBytes() returns the wrong charecter array.

No, it does not.

> IndyLength // here the given buffer is still correct.But I have a big ? 
> about the 5 I see for the size. In C++ it should be 5 + 1 (buffer length) 
> + 1 => 6

No, it should not.  5 is the correct value it should be using.  Ignore the 
null terminator.  It does not apply to TIdBytes.

> and now I get to the System::Move that moves only 5 postion of
> dat a to the buffer.

As it should be.

> the buffer is not filed with '\0'

Because it is not supposed to be.

> and the size is not set to 6 but 5.

Because TIdBytes is not meant to have a null terminator to begin with.

> I belive I need a Buffer of
>      SetLength(Result, LLength + 1);
>      CopyTIdString(AValue, AIndex, Result, 0, LLength);
>     Result[lLength] := '\0';

No, you do not.


Gambit 
Technical Details
Message-ID: <489b223b$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <489aff67@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,557264648afd1970
X-Google-Attributes: gid11508e,domainid0,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: <489aff67@newsgroups.borland.com>
Subject: Re: UDP.Broadcast corupted
Date: Thu, 7 Aug 2008 09:24:49 -0700
Lines: 63
Organization: Lebeau Software
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 207.178.157.90
Message-ID: <489b223b$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1218126395 207.178.157.90 (7 Aug 2008 09:26:35 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail