BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TIdTCPClient question

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock
View previous topic :: View next topic  
Author Message
Chad Z. Hower aka Kudzu
Guest





PostPosted: Sat Feb 28, 2004 6:08 am    Post subject: Re: TIdTCPClient question Reply with quote



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





PostPosted: Sat Feb 28, 2004 6:50 am    Post subject: Re: TIdTCPClient question Reply with quote




"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





PostPosted: Sat Feb 28, 2004 2:08 pm    Post subject: Re: TIdTCPClient question Reply with quote




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





PostPosted: Sat Feb 28, 2004 2:47 pm    Post subject: Re: TIdTCPClient question Reply with quote

"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





PostPosted: Sat Feb 28, 2004 5:30 pm    Post subject: Re: TIdTCPClient question Reply with quote

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





PostPosted: Sat Feb 28, 2004 11:28 pm    Post subject: Re: TIdTCPClient question Reply with quote


"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





PostPosted: Sun Feb 29, 2004 5:37 am    Post subject: TIdTCPClient question Reply with quote


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





PostPosted: Sun Feb 29, 2004 4:17 pm    Post subject: Re: TIdTCPClient question Reply with quote

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





PostPosted: Sun Feb 29, 2004 6:14 pm    Post subject: Re: TIdTCPClient question Reply with quote

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





PostPosted: Mon Mar 01, 2004 2:17 am    Post subject: Re: TIdTCPClient question Reply with quote


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





PostPosted: Tue Mar 02, 2004 1:05 am    Post subject: Re: TIdTCPClient question Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.