AstaClientDataSet.OpenWithBlockingSocket(TimeOut:Integer;RaiseException:Boolean)


Applies to
TAstaClientDataSet

 

Declaration
procedure OpenWithBlockingSocket(TimeOut:Integer;RaiseException:Boolean);

 

Description
Since ASTA uses Non-blocking and event driven sockets which require windows messaging using ASTA Client components in an ISAPI dll has been problematic and we have supplied AstaWinManagement.pas in order to add a message pump to

an ISAPI DLL but the results have not been consistent. So we have added some calls to allow the ASTA client socket to be used in

blocking mode. To allow the ASTAClientDataSet to be used under ASTA 2.5 we have added routines to "cache" dataset calls if the AstaClientSocket.ClientType must be set to ctBlocking.

 

This means that once the AstaclientSocket is set to block you can call normal AstaclientDataSet calls and they will be cached until you say

 

Function AstaclientSocket1.SendAndBlock(100):String;

 

Where 100 is a timeout value of how long to wait (see TWinSocketStream for details on this in the Delphi Help). Any error is returned as the function result.

 

If you want to raise an exception on the same call use

 

Function AstaclientSocket1.SendAndBlockException:String and an exception will be raised.

 

 

The following are examples of how to use these new calls.

 

procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject;

  Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);

begin

try

 AstaclientDataSet1.OpenWithBlockingsocket(500,True);

 Response.Content:='</HTML> RecordCount is '+IntTostr(AstaClientDataSet1.RecordCount)+' </HTML>';

except

  Response.Content:='<HTML> Exception(ExceptObject).Message '</HTML>';

end;

handled:=True;

end;

 

procedure TWebModule1.WebModule1WebActionItem2Action(Sender: TObject;

  Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);

begin

AstaClientSocket1.ClientType:=ctBlocking;

// you can now make as many calls as you want and they will be cached from the client

AstaClientDataSet1.ExecSQLString('Update Customer set Company='+QuotedStr(DateTimeToStr(now))+' where custno=1221');

//they will all be sent when you send this

try

 AstaClientSocket1.SendAndBlockException(100);

 Response.Content:='</HTML> Update Done </HTML>';

except

 Response.Content:='<HTML> Exception(ExceptObject).Message '</HTML>';

end;

handled:=True;

end;

 

 

 



ASTA Overview