Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Mar : Re: TIdCmdTCPServer - how to raise and return an exception?

www.cryer.info
Managed Newsgroup Archive

Re: TIdCmdTCPServer - how to raise and return an exception?

Subject:Re: TIdCmdTCPServer - how to raise and return an exception?
Posted by:"Huang Xiaobin" (hxbtoug..@yahoo.com.cn)
Date:Thu, 16 Mar 2006 14:46:05

Hi Maxim Shiryaev,

I am studying Indy10.1.5, can you give me a demo for using TIdCmdTCPServer?

thanks first.


"Maxim Shiryaev" <maxim@olma-press.ru> 写入消息新闻:44181bce$1@newsgroups.borland.com...
> Hello!
>
> I've just started to use TIdCmdTCPServer. And I don't understand how to
> correctly raise exceptions in command handler so that they be visible on a
> client side.
>
> I've created a test command handler with:
>  Command = 'RAISE_EXCEPTION'
>  ExceptionReply.Code = 555
>  ExceptionReply.Text = 'This is an exception test'
>  NormalReply.Code = 222
>  NormalReply.Text = 'This should never be seen'
>  Name = RaiseErrorHander
>
> In my OnCommand I do the following:
>
> procedure TForm1.IdCmdTCPServer1RaiseErrorHandlerCommand(
>  ASender: TIdCommand);
> begin
>  raise Exception.Create('This is the Error!');
> end;
>
> When I connect to my server using telnet and enter RAISE_EXCEPTION I get:
> 200 Welcome
> raise_error
> 222-This should never be seen
> 222 This is the Error!
>
> Instead I need the 555 reply. How to do it?
> Or may be I don't understand how server exceptions should be reported to
> clients at all?
>
> Thanks.
>
> Maxim.

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive