Article View: borland.public.cppbuilder.internet.socket
Article #635Re: Problem sending an structure with TIdTCPClient
From: Star
Date: Wed, 12 Dec 2007 20:32
Date: Wed, 12 Dec 2007 20:32
31 lines
2127 bytes
2127 bytes
I'm using C++ Builder 2007. Not sure what version of Indy comes with that. Remy Lebeau (TeamB) wrote: > "Star" <noemail@noemail.com> wrote in message > news:4760409e$1@newsgroups.borland.com... > >> I'm not sure how to do this. I used to do that with TClientSocket, >> but I cannot find the way of doing the same thing with TIdTCPClient. > > What version of Indy are you actually using? It makes a difference in how > the code has to look. > >> CLIENTTOSERVERCMD mycmd; > > What type of members does CLIENTTOSERVERCMD actually contain? > >> IdTCPClient->Socket->Write((char *)&mycmd, sizeof(mycmd),true); > > Do not use the Socket property directly like that. TIdTCPConnection (which > TIdTCPClient derives from) in Indy 9, and TIdIOHandler in Indy 10, have many > reading/writing methods of their own that you need to use instead. For > instance, in Indy 9, you could use TIdTCPConnection::WriteBuffer(), and in > Indy 10 you could use RawToBytes() and TIdIOHandler.Write(TIdBytes) instead. > > > Gambit > >
Technical Details
Message-ID:
<4760457a$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder3.cambrium.nl!feed.tweaknews.nl!newsfeed10.multikabel.net!multikabel.net!feed20.multikabel.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4760409e$1@newsgroups.borland.com> <4760433e$3@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,3de5ee2b93c32b5 X-Google-Attributes: gid11508e,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Date: Wed, 12 Dec 2007 21:32:57 +0100 From: Star <noemail@noemail.com> User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.internet.socket Subject: Re: Problem sending an structure with TIdTCPClient References: <4760409e$1@newsgroups.borland.com> <4760433e$3@newsgroups.borland.com> In-Reply-To: <4760433e$3@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 83.46.55.249 Message-ID: <4760457a$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1197491578 83.46.55.249 (12 Dec 2007 12:32:58 -0700) Lines: 31 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder3.cambrium.nl!feed.tweaknews.nl!newsfeed10.multikabel.net!multikabel.net!feed20.multikabel.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail