Article View: borland.public.cppbuilder.internet.socket
Article #524Re: How to transport 0x00 through TIdBytes
From: Remy Lebeau (TeamB)
Date: Mon, 07 Jan 2008 17:40
Date: Mon, 07 Jan 2008 17:40
55 lines
2775 bytes
2775 bytes
"Marijan Sever" <marijan.sever@codel.hr> wrote in message
news:4780bfd0@newsgroups.borland.com...
> I have some problems with sending 0x00 byte.
Then you are not sending the bytes correctly, because Indy does not treat
0x00 any differently than other bytes.
> Indy 9 (BDS2006) uses char[] for transport buffer
No, it used void* instead, which meant you could pass in just about anything
you wanted.
> Indy 10 uses TIdBytes for transport buffer (as far as I know).
There are several different ways to send buffers in Indy 10. TIdBytes is
just one of them.
> I can not use TIdBytes for transport 0x00.
0x00 works fine with TIdBytes.
> TIdBytes cbuf;
> char c[8];
You don't need a separate char[]. You can fill the TIdBytes directly, ie:
TIdBytes cbuf;
cbuf.Length = 8;
cbuf[0] = 0x01;
cbuf[1] = 0x00;
cbuf[2] = 'a';
cbuf[3] = 'b';
cbuf[4] = 0x00;
cbuf[5] = 'c';
cbuf[6] = 'd';
cbuf[7] = ?; // what are you putting here??? You allocate 8 slots but
only fill in 7 of them
> //Getting as follows
Getting where? Were are you looking at the data from? The receiver end?
If you are sending 8 bytes but only receiving 2 bytes, then that is all you
are receiving. What do you have set for the TIdUDPServer.BufferSize
property? What does your OnUDPRead event handler look like? Have you tried
using a packet sniffer to verify all of the bytes are arriving on the
receiver's network adpater to begin with?
> It seems that TIdBytes uses 0x00 as null termination for string.
No, it does not. The full Length of the buffer is always used.
Gambit
Technical Details
Message-ID:
<4782646b$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder3.cambrium.nl!feeder2.cambrium.nl!feed.tweaknews.nl!193.201.147.80.MISMATCH!news.astraweb.com!newsrouter-eu.astraweb.com!newsfeed2.ip.tiscali.net!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4780bfd0@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,bc4788af487cfd6c 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: <4780bfd0@newsgroups.borland.com> Subject: Re: How to transport 0x00 through TIdBytes Date: Mon, 7 Jan 2008 09:40:21 -0800 Lines: 57 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: <4782646b$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1199727723 207.178.157.90 (7 Jan 2008 09:42:03 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder3.cambrium.nl!feeder2.cambrium.nl!feed.tweaknews.nl!193.201.147.80.MISMATCH!news.astraweb.com!newsrouter-eu.astraweb.com!newsfeed2.ip.tiscali.net!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail