Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > keeping a COM server alive

Reply
Thread Tools

keeping a COM server alive

 
 
xeoicq@netscape.net
Guest
Posts: n/a
 
      02-14-2005
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)

 
Reply With Quote
 
 
 
 
Do Re Mi chel La Si Do
Guest
Posts: n/a
 
      02-14-2005
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.




 
Reply With Quote
 
 
 
 
Steve Holden
Guest
Posts: n/a
 
      02-15-2005
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 http://www.velocityreviews.com/forums/(E-Mail Removed) as
a list where the readers will be more directly in tune with your needs.

regards
Steve

 
Reply With Quote
 
Do Re Mi chel La Si Do
Guest
Posts: n/a
 
      02-15-2005
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



 
Reply With Quote
 
xeoicq@netscape.net
Guest
Posts: n/a
 
      02-17-2005
Hi,

thanks, I 'll post the problem in (E-Mail Removed) ...

Frank

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How keep python socket alive for ever by setting Keep alive flag. hisan Python 1 06-25-2012 05:30 PM
What is the best way of keeping a server-side object alive between page refreshes? damian.jolly@sageautomation.com ASP .Net 2 05-03-2006 12:47 PM
Keeping server-side object alive Liam ASP .Net Web Services 0 07-15-2005 02:27 PM
Keeping a Session alive during long downloads hoenes1 ASP .Net 0 08-16-2004 12:02 PM
Keeping alive ISDN 128k to ISP Mr Sanghez Cisco 2 07-06-2003 06:17 PM



Advertisments