🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Problem sending an structure with TIdTCPClient

#634
From: Remy Lebeau (TeamB)
Date: Wed, 12 Dec 2007 20:22
24 lines
1926 bytes
"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: <4760433e$3@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4760409e$1@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
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <4760409e$1@newsgroups.borland.com>
Subject: Re: Problem sending an structure with TIdTCPClient
Date: Wed, 12 Dec 2007 12:22:02 -0800
Lines: 26
Organization: Lebeau Software
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
NNTP-Posting-Host: 207.178.157.90
Message-ID: <4760433e$3@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1197491006 207.178.157.90 (12 Dec 2007 12:23:26 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail