Skip to content

Delphi Labs: New "Server Methods Lifecycle" episode is live!

It is more fun and work as I expected but here there is: The third episode in the Delphi Labs "DataSnap" serie. My goal is to consistently release one new episode about Delphi DataSnap programming every week in this quarter. The demos are intentionally simple and all the steps documented in a detailed way so it should be OK to follow even for non-experienced Delphi XE users. In the video episodes I have decided to reduce resolution, but I am still doing zooming and panning in Camtasia before producing a file to mp4. If you have any feedback regarding the format of Delphi Labs please do not hesitate to comment here. Appreciated!

In the first part of this lab I’m using Delphi XE to build a DataSnap VCL Forms app server and client application. The server method instance has overridden constructor where its private FID is initialized with a generated GUID and "GetId" server method is implemented to be able to uniquely identify a server methods instance on the client. The client app has a button and a label where the value of server method instance ID is displayed. At the end we see that with default DSServerClass.LifeCycle value of "Session" every connected client has its own server methods instance inside the server application.

“Delphi Labs: DataSnap XE - Server Methods Lifecycle (Part 1/2)”

http://www.youtube.com/watch?v=VI_o6bwIfkM

In the second part of the lifecycle demo we are extending both server and client applications. In the server we are adding two new TDSServerClass components with other possible values for lifecycle: server and invocation. Implementations of all three server classes are identical and they provide "GetID" server method that returns an instance GUID value and let us identify instances inside the server. The client interface is extended and DataSnap proxies are regenerated. At the end of the demo we verify that server method instances are global to all clients, session instances are unique per client and invocation instances created and destroyed on the fly.

“Delphi Labs: DataSnap XE - Server Methods Lifecycle (Part 2/2)”

http://www.youtube.com/watch?v=XcLOm-v7Ing

The source code for this demo is available at http://cc.embarcadero.com/item/28199 and whitepaper at http://edn.embarcadero.com/article/41289

{ 3 } Comments

  1. Franz Maurer | June 8, 2012 at 9:45 am | Permalink

    Hi Pawel,
    I tried some of your Delphi Labs demo’s on XE2. I ran the Lifecycle demo. The error I get when starting up more than one Client at once is for some of them "Connection Closed Gracefully" or "Socket Error # 10053, Software caused connection abort".
    Any clue?

    - Franz Maurer

  2. Pawel Glowacki | January 8, 2013 at 10:16 am | Permalink

    Hi Franz,
    I have not tested this demo with XE2, but I will give it a try:-)

  3. Visit My Webpage | January 3, 2014 at 9:02 am | Permalink

    Hello there, You have done an incredible job. I will certainly digg it and in my view recommend to my friends. I’m confident they’ll be benefited from this site.

Post a Comment

Your email is never published nor shared. Required fields are marked *

Bad Behavior has blocked 2 access attempts in the last 7 days.

Close