🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
4 messages
4 total messages Started by Darlington ADIBE Wed, 23 Nov 2005 14:01
Indy CommandHandler (CR+LF) Issue
#3121
Author: Darlington ADIBE
Date: Wed, 23 Nov 2005 14:01
30 lines
2138 bytes
Hello All,

With help from the group (Remy and others) I have successfully installed
indy 9017 on BCB6 Enterprise, which I must have made my codeing more easy
until now.

I used the commandhandler of the IdTCPSerever to handle cmd from the client,
I used the '#' sysbol as both my command delimiter and Parameter delimiter
it all worked great for the modules I have done so far until I got to this
module. The Client send a cmd.sprintf ("SENDTO#'%s'#'%s'#, Memo1->Text,
LabeledEdit1->Text) to the server.

The CommandHandler for SENDTO was trigered ok. but the unparsedParams value
(am not parsing param) contain only the first line from the memo1-text,
after the commadhandler have removed the "SENDTO#".

My observation is that the Commandhandler stoped reading after CR or CR+LF,.

So how do I pass a parameter to the commandhandler if the parameter is the
text value of controls like Memo controlls that insert CR and or CR+LF as
you type if WordWrap is set to true (which in my vase have to be).

Do I have controll over what is considered the ATerminator for the
commandhandler, like when I use ReadLn, or how do I control the
commandhabdler Line Terminator char. (I believe that the commandhandler uses
the ReadLn to read from the Thread).

Thanx.

Darl.
Re: Indy CommandHandler (CR+LF) Issue (MORE INFO)
#3123
Author: Darlington ADIBE
Date: Wed, 23 Nov 2005 14:08
6 lines
1154 bytes
FYI:

When I set the WordWrap and WantReturn of the Memo1 to false it all worked
fine, but that setting those not fit into my Application, I need the Memo1
to be free formated provided that the Text lenght does not exceed 256
(including CR, LF) and no '#' within the text (I check on keypress)
TEMP Solution
#3124
Author: Darlington ADIBE
Date: Wed, 23 Nov 2005 17:31
12 lines
1175 bytes
Hello all,

Here is what I consider a temp solution.

I have writen a function that will parsea the Memo text and replace all
"\r\n" with "<CRL>" on the client side and reserved the replacement on the
Server side, it works great. But i still need any profession way of handling
it if any.

Thanx.

Darl
Re: Indy CommandHandler (CR+LF) Issue
#3125
Author: Remy Lebeau (TeamB)
Date: Wed, 23 Nov 2005 18:24
53 lines
2772 bytes
"Darlington ADIBE" <bcb@triative.com> wrote in message
news:43847621@newsgroups.borland.com...

> The CommandHandler for SENDTO was trigered ok. but
> the unparsedParams value (am not parsing param) contain
> only the first line from the memo1-text, after the commadhandler
> have removed the "SENDTO#".

The CommandHandler system does not support multi-line commands.

> My observation is that the Commandhandler stoped reading
> after CR or CR+LF,.

The CommandHandler system uses ReadLn() to receive commands, where the line
terminator is LF.  When the terminator is LF, ReadLn() will stop reading
when it encounters either a LF or a CRLF.  It will not stop on a solitary
CR.

> So how do I pass a parameter to the commandhandler if the
> parameter is the text value of controls like Memo controlls that
> insert CR and or CR+LF as you type if WordWrap is set to true
> (which in my vase have to be).

Don't insert line breaks into the middle of a command in the first place.
Replace them with another character sequence that will not break the reading
of the command.  For example:

    AnsiString s = StringReplace(Memo1->Text, "\r\n", "\r", TReplaceFlags()
<< rfReplaceAll);
    cmd.sprintf("SENDTO#'%s'#'%s'#, s.c_str(), LabeledEdit1->Text.c_str());

    //...

    AnsiString s = StringReplace(ASender->UnparsedParams, "\r", "\r\n",
TReplaceFlags() << rfReplaceAll);

> Do I have controll over what is considered the ATerminator for
> the commandhandler

No.

> like when I use ReadLn

The CommandHandler system uses ReadLn() to receive commands.  But it does
not allow you to specify the ATerminator parameter.

> how do I control the commandhabdler Line Terminator char.

You cannot, unless you rewrite and recompile TIdTCPServer manually.


Gambit
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads