| View previous topic :: View next topic |
| Author |
Message |
Chad Z. Hower aka Kudzu Guest
|
Posted: Sat Feb 28, 2004 6:08 am Post subject: Re: TIdTCPClient question |
|
|
Lee <leeSPAMSUCKS (AT) datatrakpos (DOT) com> wrote in news:4040294c$1
@newsgroups.borland.com:
| Quote: | I have a question about this component. Is there a recommended way to
handle instances when the we don't know how big the data coming in is or
what token is used to indicate the end of the stream?
|
Just read whats currently in the buffer.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
Is Indy useful to you? Send a postcard please!
http://www.hower.org/kudzu/indypost.html
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Sat Feb 28, 2004 6:50 am Post subject: Re: TIdTCPClient question |
|
|
"Lee" <leeSPAMSUCKS (AT) datatrakpos (DOT) com> wrote
| Quote: | Is there a recommended way to handle instances when the we
don't know how big the data coming in is or what token is used
to indicate the end of the stream?
|
What kind of protocol are you using that would have such an obvious
limitation? You need at least one of those conditions in order to process
data in a coordinated fashion. The only other scenerio is if you simply
want to read all of the data from the socket until the connection is
terminated, and then process whatever was sent.
What exactly is the scenerio you are trying to handle?
Gambit
|
|
| Back to top |
|
 |
Martin James Guest
|
Posted: Sat Feb 28, 2004 2:08 pm Post subject: Re: TIdTCPClient question |
|
|
| Quote: | Just read whats currently in the buffer.
|
Would you not have to call readFromStack, or the like, first, so as to
actually get data into the Indy buffer?
Another thought - how about just calling iohandler.recv to load input
directly into a fixed-size user buffer?
Rgds,
Martin
|
|
| Back to top |
|
 |
Chad Z. Hower aka Kudzu Guest
|
Posted: Sat Feb 28, 2004 2:47 pm Post subject: Re: TIdTCPClient question |
|
|
"Martin James" <mjames_falcon (AT) dial (DOT) pipex.com> wrote in
news:4040a0ea (AT) newsgroups (DOT) borland.com:
| Quote: | Would you not have to call readFromStack, or the like, first, so as to
actually get data into the Indy buffer?
|
Only if you read directly from the buffer, which you should not need to do.
There are several methods that give you everything available and also call
ReadFromStack.
| Quote: | Another thought - how about just calling iohandler.recv to load input
directly into a fixed-size user buffer?
|
You should avoid calling recv directly.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
Qualified help FAST with Indy Experts Support
from the experts themselves:
http://www.atozed.com/indy/experts/support.iwp
|
|
| Back to top |
|
 |
Chad Z. Hower aka Kudzu Guest
|
Posted: Sat Feb 28, 2004 5:30 pm Post subject: Re: TIdTCPClient question |
|
|
Lee <leeSPAMSUCKS (AT) datatrakpos (DOT) com> wrote in news:4040bf53$1
@newsgroups.borland.com:
| Quote: | They sent me a sample using a standard ClientSocket which was
non-blocking and the example just read until the connection was terminated.
|
This is easy. See the souce in IdWhois.pas for an example.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
Want more Indy stuff? Try the Atozed Indy Portal at
http://www.atozedsoftware.com/
* More Free Demos
* Free Articles
* Extra Support
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Sat Feb 28, 2004 11:28 pm Post subject: Re: TIdTCPClient question |
|
|
"Lee" <leeSPAMSUCKS (AT) datatrakpos (DOT) com> wrote
| Quote: | ... using a standard ClientSocket which ... just read
until the connection was terminated.
|
The AllData() method of TIdTCPConnection will handle that scenerio.
Alternatively, you can call ReadStream() with the AByteCount parameter set
to -1 and the AReadUntilDisconnect parameter set to True.
Gambit
|
|
| Back to top |
|
 |
Lee Guest
|
Posted: Sun Feb 29, 2004 5:37 am Post subject: TIdTCPClient question |
|
|
Hello all,
I have a question about this component. Is there a recommended way to
handle instances when the we don't know how big the data coming in is or
what token is used to indicate the end of the stream?
I haven't worked with the network/tcpip much so any help would be
appreciated.
Thank you,
Lee
|
|
| Back to top |
|
 |
Lee Guest
|
Posted: Sun Feb 29, 2004 4:17 pm Post subject: Re: TIdTCPClient question |
|
|
Remy Lebeau (TeamB) wrote:
| Quote: |
What kind of protocol are you using that would have such an obvious
limitation? You need at least one of those conditions in order to process
data in a coordinated fashion. The only other scenerio is if you simply
want to read all of the data from the socket until the connection is
terminated, and then process whatever was sent.
What exactly is the scenerio you are trying to handle?
|
The server is sending an XML packet that I need to read. As of now, I
am using the ReadLine method and using the closing tag that
(</ClosingTag>) as the eol character. This works, but its case
sensitive so if they were to change it, it would no longer work and I
wanted to figure out a way to do so that it won't break.
They sent me a sample using a standard ClientSocket which was
non-blocking and the example just read until the connection was terminated.
I prefer to use Indy since what little experience I have, is using that.
Thanks again,
Lee
|
|
| Back to top |
|
 |
Lee Guest
|
Posted: Sun Feb 29, 2004 6:14 pm Post subject: Re: TIdTCPClient question |
|
|
| Quote: | This is easy. See the souce in IdWhois.pas for an example.
|
I will take a look....
Thank you,
Lee
|
|
| Back to top |
|
 |
Lee Guest
|
Posted: Mon Mar 01, 2004 2:17 am Post subject: Re: TIdTCPClient question |
|
|
| Quote: | The AllData() method of TIdTCPConnection will handle that scenerio.
Alternatively, you can call ReadStream() with the AByteCount parameter set
to -1 and the AReadUntilDisconnect parameter set to True.
Gambit
|
Thank Gambit,
I will try that.
Lee
|
|
| Back to top |
|
 |
Lee Guest
|
Posted: Tue Mar 02, 2004 1:05 am Post subject: Re: TIdTCPClient question |
|
|
| Quote: | The AllData() method of TIdTCPConnection will handle that scenerio.
Alternatively, you can call ReadStream() with the AByteCount parameter set
to -1 and the AReadUntilDisconnect parameter set to True.
Gambit
|
Worked like a champ.
Thank you,
Lee
|
|
| Back to top |
|
 |
|