keeping a COM server alive

Discussion in 'Python' started by xeoicq@netscape.net, Feb 14, 2005.

  1. Guest

    I have implemented a local COM Server with win32com framework where all
    clients
    use the same global object (test_obj). So far it works, but when the
    last client
    is closed the gobal object is deleted because the pythonw.exe is
    closed. When I
    create a new client a new pythonw process is started. I need that the
    new client
    gets the same global object. How can I prevent the Python COM
    enviornment
    (pythonw.exe) to close when no client exist. I figured out a
    workaround, but
    there must be real solution to the problem.



    The code looks like:

    class test:
    ...

    test_obj=test()


    class test_F:

    _reg_clsid_ = ...
    _reg_progid_ = "test.cl"
    _reg_clsctx_ = pythoncom.CLSCTX_LOCAL_SERVER
    _public_methods_ = ...


    def __init__(self):
    self.delegate=test_obj
    ....
    ...


    ####Workaround to keep the local server alive
    if not __name__=='__main__':
    import win32com.client
    dummy=win32com.client.Dispatch("test.cl")
    ##########################################################


    if __name__=='__main__':
    import win32com.server.register
    win32com.server.register.UseCommandLine(test_F, debug=0)
    , Feb 14, 2005
    #1
    1. Advertising

  2. Hi !

    I had also make a Python-COM-server.
    But, when I launch several clients, I obtain several instances of my
    COM-server.

    Finally, there are advantages and disadvantages in this established fact.
    But I can't use this way for to exchange data between several clients. For
    that, I use a TCP local server.

    @-salutations
    --
    Michel Claveau



    note : the same problem come with Microsoft's dictionnary COM server.
    Do Re Mi chel La Si Do, Feb 14, 2005
    #2
    1. Advertising

  3. Steve Holden Guest

    Do Re Mi chel La Si Do wrote:

    > Hi !
    >
    > I had also make a Python-COM-server.
    > But, when I launch several clients, I obtain several instances of my
    > COM-server.
    >
    > Finally, there are advantages and disadvantages in this established fact.
    > But I can't use this way for to exchange data between several clients. For
    > that, I use a TCP local server.
    >

    There are settings you can establish to determine the interactions
    between the COM server and its clients (threading model, in-process or
    out-of-process, etc).

    If you don't get an answer on this list, try as
    a list where the readers will be more directly in tune with your needs.

    regards
    Steve
    Steve Holden, Feb 15, 2005
    #3
  4. Hi !

    Sorry, but I receive the mailing list, I had readed THE book (Prog...Win32),
    I questioned M.Hammond, I traversed the archives...
    But I have no solution.

    And, also, a COM server which answers several clients is very smart to
    design; in particular because of the temporal re-entry (re-entrance ?)

    @-salutations
    --
    Michel Claveau
    Do Re Mi chel La Si Do, Feb 15, 2005
    #4
  5. Guest

    Hi,

    thanks, I 'll post the problem in ...

    Frank
    , Feb 17, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. hoenes1
    Replies:
    0
    Views:
    372
    hoenes1
    Aug 16, 2004
  2. =?Utf-8?B?RGF2ZSBBbHZhcmFkbw==?=

    Keeping a session alive when accessing an ASP page with .Net code

    =?Utf-8?B?RGF2ZSBBbHZhcmFkbw==?=, Sep 1, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    633
    =?Utf-8?B?RGF2ZSBBbHZhcmFkbw==?=
    Sep 1, 2005
  3. Replies:
    2
    Views:
    540
    =?Utf-8?B?V2lsbGlhbSBTdWxsaXZhbg==?=
    May 3, 2006
  4. Liam

    Keeping server-side object alive

    Liam, Jul 15, 2005, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    120
  5. hisan
    Replies:
    1
    Views:
    1,302
    Dan Stromberg
    Jun 25, 2012
Loading...

Share This Page