Article View: borland.public.cppbuilder.internet.socket
Article #2158Re: indy 9 and TidTcpServer
From: fabrice
Date: Wed, 02 Aug 2006 13:28
Date: Wed, 02 Aug 2006 13:28
48 lines
2683 bytes
2683 bytes
ok thanks for the reply "Remy Lebeau (TeamB)" <no.spam@no.spam.com> a οΏ½crit dans le message de news: 44cfb7b2$1@newsgroups.borland.com... > > "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:
<44d0a897@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.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-mailReferences:
<44cf20f5$1@newsgroups.borland.com> <44cfb7b2$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 Reply-To: "fabrice" <f.marcantuoni@splin-rd.com> From: "fabrice" <f.marcantuoni@splin-rd.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <44cf20f5$1@newsgroups.borland.com> <44cfb7b2$1@newsgroups.borland.com> Subject: Re: indy 9 and TidTcpServer Date: Wed, 2 Aug 2006 15:28:53 +0200 Lines: 50 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 194.78.199.158 Message-ID: <44d0a897@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1154525335 194.78.199.158 (2 Aug 2006 06:28:55 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.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