如何重用与第二客户端(德尔福)OLE服务器? [英] How to reuse a (Delphi) OLE server with a second client?

查看:305
本文介绍了如何重用与第二客户端(德尔福)OLE服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写的(使用Delphi)的OLE自动化服务器。我通常手动启动OLE服务器,并使用它作为一个正常的应用程序。不时我开始一个客户端,
自动连接到现有的OLE服务器。

I wrote an OLE automation server (using Delphi). I usually start the OLE server manually and use it as a normal application. From time to time I start a client, which automatically connect to the existing OLE Server.

当我结束在客户端,服务器不会终止(至少在手动客户端之前开始),但它不会接受任何其他OLE连接。启动另一个客户端将引发新服务器,而不是重用第一个的。

When I terminate the client, the server does not terminate (at least when it was started manually before the client) but it won't accept any other OLE connection. Starting another client will trigger a new server instead of reusing the first one.

我怎么能重复使用第二个客户端在同一台服务器?

How can I reuse the same server with the second client?

(编辑题正确地改写它。在原来的版本我是问如何prevent服务器从终端,这是不是一个很好的配方)

(Question edited to reformulate it correctly. In the original version I was asking how to prevent the server from terminating, which wasn't a good formulation)

推荐答案

有是在Delphi的COM对象向导的设置实例化。允许的值是内部,多重背景,单实例。

There is a setting "Instancing" in the COM Object Wizard in Delphi. Allowed values are "internal", "Multiple Instance", "Single Instance".

我想重复使用多个客户端相同的COM服务器。这就是为什么我选择了单一实例,虽然,我有我的服务器应用程序的单个实例为所有的客户端。但是我错了。 单实例是指将有只有一个在我的服务器COM连接的实例。我应该选择多实例,允许在同一个服务器上有多个COM连接(但一前一后,不同步)。

I wanted to reuse the same COM server with multiple clients. That is why I chose "single Instance" and though that I would have a single instance of my server application for all the clients. But I was wrong. "Single Instance" means that there will be only one instance of a COM connection in my server. I should have chosen "Multiple Instance" to allow multiple COM connection (but one after the other, not simultaneous) in the same server.

我认为在Delphi中COM对象向导使用的文字是不是真的不清楚。相反,多实例,单实例,这将是最好有多用途和一次性使用想在这个的文章有关OLE服务器和VB

I think that the words used in the COM Object Wizard in Delphi are not really clear. Instead of "multiple instance", "single instance", it would be better to have "multiuse" and "single use" like in this article about OLE Server and VB.

这篇关于如何重用与第二客户端(德尔福)OLE服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆