Midware TAppSrvClient.OnRequestDone

From Overbyte
Revision as of 11:03, 14 May 2011 by Marie (talk | contribs) (→‎Definition)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Main page -> Midware component reference -> TAppSrvClient -> OnRequestDone


<syntaxhighlight lang="delphi"> type TRequestDone = procedure (Sender : TObject; Error : Integer) of object;

property OnRequestDone : TRequestDone; </syntaxhighlight>


Occurs when a request has been statisfied and result set is available.

When the application server sent the answer to the client, the OnRequestdone event is triggered. The corresponding event handler is the right place to test for success or failure, and to parse the answer to extract the returned info to update the user interface or do whatever needs to be done with the request's result. See sample code. It is also the right place to close communication using Close methods.

There are two levels of errors: at client side and at server side. The argument Error gives an error code related to client side, AnswerStatus gives an error code of phrase related to server side. Values for the Error argument may be any operating system error code, more specifically winsock errors (in the range 10000 to 12000). See windows documentation for error list.

Most common errors are:

10061:Connection refused. Probably server do not run, or server IP address or port number is wrong.

10065: Host unreachable. Probably TCP/IP setup incorrectly done.

10053, 10054, 10057: Connection error. Probably phone hangup, carrier lost, cable broken, server hung and all such failures.