Board index » delphi » General indy questions

General indy questions


2003-06-27 05:24:28 PM
delphi250
Hi all,
Since I am new to Indy I have some general questions...
I have a tcpclient and server in one application. I know about the
commandhandlers which are very useful (i think) BUT:
1) What is the difference between ReplyNormal (Text? / Texcode?) and
Response? (for a CommandHandler)
2) When to use these?
3) How does a tcpClient know that the server sends data? (since there is no
OnDataAvailable event for a client)
4) What are the ReplyTexts for? (tcpServer)
Thanks!
 
 

Re:General indy questions

"Redz" <XXXX@XXXXX.COM>writes
Quote
1) What is the difference between ReplyNormal (Text? / Texcode?) and
Response? (for a CommandHandler)
From the docs:
TIdRFCReply is a TPersistent descendant that implements an RFC-compliant
response that consists of a response code (in both numeric and textual form)
and one or more lines of Text messages. TIdRFCReply is used by Indy servers
and command handlers to represent the responses used for a specific
protocol.
NumericCode is an optional value representing the numeric response for a
protocol message, and can be omitted when only the Text portion of a
response is significant in the protocol. TextCode is the literal extracted
from the response message prior to conversion to numeric form.
Text can contain multiple lines, and is generated using the continuation
response mechanism common to many RFC-compliant protocols. For example, a
response with the NumericCode of 200 and multiple lines in Text might be
sent like the following:
200-You were connected
200-Your session started
200 Ok
Quote
2) When to use these?
ReplyNormal is the standardized "success" response for a specific protocol.
Look at some of the servers (SMTP, POP3, FTP, etc.) to get an idea of how
standard responses are used.
Quote
3) How does a tcpClient know that the server sends data? (since there is
no
OnDataAvailable event for a client)
That's an asynchronous king of thing. Indy uses blocking sockets.
Also... most protocols will dictate what to send and what to expect as a
response. So an OnDataAvailable type event is not needed unless you don't
know what to expect or when it will arrive.
Quote
4) What are the ReplyTexts for? (tcpServer)
ReplyText is a place to store any standardized responses that your protocol
(or standardized protocol) might use. You can use FindByNumber,
UpdateReply, UpdateText to massage a TIdReply for use in your server. See
how it is implemented in TIdNNTPServer.
hth...
Join the Indy Docs project! (www.indyproject.org/teams/docs)
ELKNews - Get your free copy at www.atozedsoftware.com