Article View: borland.public.cppbuilder.internet.socket
Article #521How to transport 0x00 through TIdBytes
From: Marijan Sever
Date: Sun, 06 Jan 2008 11:47
Date: Sun, 06 Jan 2008 11:47
39 lines
2226 bytes
2226 bytes
Would you be so kind and help? I have been using UDP communication for a while (BC++ 6.0). While transfering the projects from BDS2006 C++ to CodeGear 2007 C++, I have some problems with sending 0x00 byte. Indy 9 (BDS2006) uses char[] for transport buffer, Indy 10 uses TIdBytes for transport buffer (as far as I know). I can not use TIdBytes for transport 0x00. We are using TIdUDPServer and TIdUDPClient components for industrial automation communication, where 0x00 is valid data. The sample code is below (tried to use other ways to fill TIdBytes, but allways with same result). //------------------------------------------------------------------------- TIdBytes cbuf; char c[8]; c[0]=0x01; c[1]=0x00; c[2]='a'; c[3]='b'; c[4]=0x00; c[5]='c'; c[6]='d'; cbuf.Length=8; RawToBytesF(cbuf,c,8); UdpServ->SendBuffer(shost,iport,cbuf); //------------------------------------------------------------------------- //Getting as follows; cbuf[0]=0x01,cbuf[1]=0x00 - and nothing further It seems that TIdBytes uses 0x00 as null termination for string. Am I doing something wrong or this kind is a feature of Indy 10 (or bug) ? Appreciate any suggestion.. Best regards, Marijan
Technical Details
Message-ID:
<4780bfd0@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!feeder.news-service.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 11508e,bc4788af487cfd6c,start X-Google-Attributes: gid11508e,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Reply-To: "Marijan Sever" <marijan.sever@codel.hr> From: "Marijan Sever" <marijan.sever@codel.hr> Newsgroups: borland.public.cppbuilder.internet.socket Subject: How to transport 0x00 through TIdBytes Date: Sun, 6 Jan 2008 12:47:25 +0100 Lines: 43 Organization: Codel 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; Original NNTP-Posting-Host: 89.172.46.39 Message-ID: <4780bfd0@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1199620048 89.172.46.39 (6 Jan 2008 03:47:28 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!feeder.news-service.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail