mara21
mara21

Reputation: 75

DataSnap migration from Delphi 7 to XE6

Sorry again for my english, I already migrating client and the server and everything worked well, until I noticed that Remote Data Module of the server is not working what is expected. When I run query from a client that requires more time, the other Remote Data Modules remain on hold (including and the main thred). It behaves like thread model is tmSingle. I looked around and tried everything I found with no success. Even more strange is that where I registered the new server (builded with XE6), the old one (builded with D7) started giving the same symptoms.

When installing the new server on machine that is alredy running the old one I use

xxxxx.exe /unregserver (for the old one) and

xxxxx.exe /regserver (for the new one), and then is noticeable the problem. Even if I unregister the new server, and register the old one the problem stays.

The client and the server communicate via DataSnap Socket (the client with TSocketConnection and TConnectionBroker).

Here is some info for the server

Server_TLB

unit Server_TLB;
uses Windows, ActiveX, Classes, Graphics, Midas, StdVCL, Variants;
const

  LIBID_Server: TGUID = '{xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx}';

  IID_IrdmServer: TGUID = '{xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx}';
  CLASS_rdmServer: TGUID = '{xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx}';

  IrdmServer = interface;
  IrdmServerDisp = dispinterface;

  rdmServer = IrdmServer;

  IrdmServer = interface(IAppServer)
    ['{xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx}']
    ........... methods..........


  IrdmServerDisp = dispinterface
    ['{xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx}']
    ........... methods..........

  CordmServer = class
    class function Create: IrdmServer;
    class function CreateRemote(const MachineName: string): IrdmServer;

implementation

uses ComObj;

class function CordmServer.Create: IrdmServer;
begin
  Result := CreateComObject(CLASS_rdmServer) as IrdmServer;
end;

class function CordmServer.CreateRemote(const MachineName: string): IrdmServer;
begin
  Result := CreateRemoteComObject(MachineName, CLASS_rdmServer) as IrdmServer;
end;

end.

..initialisation of the RDM

initialization
  TComponentFactory.Create(ComServer, TrdmServer,
    Class_rdmServer, ciMultiInstance, tmFree);

..the sequence of creation

    Forms.Application.ShowMainForm := False;
    Forms.Application.Initialize;
    Forms.Application.CreateForm(TdmServer, dmServer);
    Forms.Application.CreateForm(TfMain, fMain);
    windows.PostMessage(fMain.Handle, MSG_INITIALIZE, 0, 0);
    Forms.Application.Run;

with standard SocketDispatcher and standart SConnect

Also alredy tryed with setting key

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx}\InprocServer32]
"ThreadingModel"="Free" or "Both"

I miss something else?

Thank you for the help!

Upvotes: 1

Views: 820

Answers (2)

LDS
LDS

Reputation: 346

I suggest you to check:

Security on a Midas / DataSnap server: http://qc.embarcadero.com/wc/qcmain.aspx?d=8814

Also, the socket server is deprecated and has some drawbacks:

  • It bypasses DCOM security. Everything is run in the security context of the user which runs the server (if it is localsystem, it has the most powerful privileges - beware of that)
  • Connection is not encrypted unless you write a module for it, which lacks basic securee key exchange features. DCOM can encrypt and authenticate packets (although its encryption is today not really strong) - you just need to configure it in dcomcnfg.
  • It doesn't support 64 bit values and other types, see http://qc.embarcadero.com/wc/qcmain.aspx?d=69924

Upvotes: 1

mjn
mjn

Reputation: 36634

In this situation I would create a simple DataSnap client / server application with the correct threading model, test it, and then compare the auto-generated server module code with the code in your migrated project.

This way, you can detect the critical differences, adjust the code to be the equivalent in the test project server module.

Upvotes: 1

Related Questions