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

www.cryer.info
Managed Newsgroup Archive

TIdCmdTCPServer - how to raise and return an exception?

Subject:TIdCmdTCPServer - how to raise and return an exception?
Posted by:"Maxim Shiryaev" (max..@olma-press.ru)
Date:Wed, 15 Mar 2006 16:51:39

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:

www.cryer.info
Managed Newsgroup Archive