🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: indy 9 and TidTcpServer

#2154
From: Remy Lebeau (TeamB)
Date: Tue, 01 Aug 2006 20:19
37 lines
2331 bytes
"fabrice" <f.marcantuoni@splin-rd.com> wrote in message
news:44cf20f5$1@newsgroups.borland.com...

> Before to read using "AThread->Connection->Socket->Recv(ptr,len)"

Do NOT call Recv() directly!  Use the reading methods from TIdTCPConnection
instead, such as ReadBuffer():

    AThread->Connection->ReadBuffer(ptr, len);

> How can I know exactly the bytes that has been received in the socket ?

TCP is a byte stream.  If you want to know the size of a particular buffer
within that stream, then you should be sending the buffer size before then
sending the buffer data.  Indy is a blocking library.  If you tell it to
read xxx number of bytes, then it waits until at least xxx number of bytes
are available before returning them.

> How can I know exactly the bytes that has been received in the socket ?

What you are asking for applies primarily to asynchronous sockets, not
blocking sockets.  That is not the case with Indy.  You tell it how much to
read, and it returns that much back to you, internally handling all of the
waiting and gathering of packet pieces for you.

If that does not work for your situation, then your only option is to use
CurrentReadBuffer(), which returns a String of all available bytes.  Or
alternatively call ReadFromStack() and then manually pull the available
bytes from the InputBuffer property.

> Is a method like ReceiveLength() exist with TidTcpServer?

No.


Gambit
Technical Details
Message-ID: <44cfb7b2$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <44cf20f5$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,f38499e0180289f2
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <44cf20f5$1@newsgroups.borland.com>
Subject: Re: indy 9 and TidTcpServer 
Date: Tue, 1 Aug 2006 13:19:36 -0700
Lines: 39
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <44cfb7b2$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1154463666 68.69.17.41 (1 Aug 2006 13:21:06 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail