🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

TIdTCPClient lack of Knowledge

#2590
From: Bilgi Sakarya
Date: Mon, 13 Mar 2006 17:23
53 lines
2825 bytes
Hello,

I'm desperately trying to do receive data with TIdTCPClient. (Version 9.0.5)
with BCB2006
The TIdTCPClient has an Intercept of TIdConnectionIntercept and I/O Handler
of TIdIOHandlerSocket.

Now, on a button click I send a request that looks as follows and works
perfectly

 STRUCT_SQL sRequest;

 sRequest.iMessageType = SQL_REQUEST_ID;
 sRequest.lTicket = rand() % 1000000;
 sRequest.lTicket = sRequest.lTicket + 999999;
 strcpy( sRequest.szSQL, szSQL.c_str() );

 tcp_client->WriteBuffer( &sRequest, sizeof( sRequest), true );

the server receives the request and sends the answer. The server is not
programmed by myself and is in use for ages now.
To make sure I there is no proplem with the server we did some tests with a
client in python and it worked just perfectly.
But I have to write that code in BCB 2006.

But in BCB 2006 I get absolutely now events triggered!!
Strange enough, when adding following line of code after the WriteBuffer
Method a get the OnReceive Event triggered!!!!

 AnsiString str_line = tcp_client->ReadLn( "\r\n", 1000,
sizeof(STRUCT_STRING_RESULT) );

But here, sometimes it works, some it doesn't. I think I'm missing something
but with that documentation I'm not getting anywhere. First most of the
examples are written for Delphi and handle to basic stuff like sending some
"Hello World" strings.
My problem is, that I'm passing quite large data, that means the size varies
between 1000 and 200000 bytes depending on the request. That means, that I'm
receiving more than one packet.

Can anybody please explain me or give me an idea how I have to do this. What
is also strange, that Indy 9 on BCB6 works totally different.

There the OnWorkBegin, OnWork and OnWorkEnd are triggered. But I'm not
getting the amount of Bytes I'm expecting.

So basically what I would like to know is:
How do I receive large data with Indy Components?

Please, please help.

Thanks
Bilgi
Technical Details
Message-ID: <4415a914$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,422c519991c90239,start
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Bilgi Sakarya" <b.sakarya@riskreturn.ch>
From: "Bilgi Sakarya" <b.sakarya@riskreturn.ch>
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: TIdTCPClient lack of Knowledge
Date: Mon, 13 Mar 2006 18:23:05 +0100
Lines: 57
Organization: FAM
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 212.117.204.194
Message-ID: <4415a914$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1142270228 212.117.204.194 (13 Mar 2006 09:17:08 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail