O'Reilly logo

Python Programming On Win32 by Mark Hammond, Andy Robinson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

DCOM

Distributed COM does it all for you. You don’t have to change a single line of your Python code. All you need is to enable a few settings on the server (which are not specific to this application, but to DCOM in general) and to change one line in the client code. Here are the steps:

  1. DCOM needs to be enabled on the remote server. Choose Start Run and type dcomcnfg.exe. A configuration dialog starts up. Select the Default Properties tab and check the box for Enable Distributed COM on this computer.

  2. Python and PythonWin should be installed properly on the server, and the Doubletalk COM server should be registered.

  3. In our Visual Basic program, go to the line of code where we create the BookServer, and add a parameter for the remote machine name. We added an extra box in the Options dialog, the contents of which are stored in the variable RemoteMachine. Here’s the startup code:

    Set BookServer = CreateObject("Doubletalk.BookServer", RemoteMachine)

    If the string RemoteMachine is empty, the local server starts up. Otherwise, DCOM talks to the remote machine, and the BookServer starts up there. All calls to the COM object and any return values (including large arrays of data) are automatically packaged and transported across the network.

To demonstrate this, we created a data file called remotedata.dtj on a machine called yosemite and ran the client on a different machine. In the Options box input the name yosemite and hit the Reload button. At this point, the COM server starts on the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required