服务器准备好了? [英] Is Server Ready?

查看:85
本文介绍了服务器准备好了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的远程客户端代码的关键点,我知道服务器进程已经启动,但我不知道它已准备好进行远程调用。我想编写一个WaitUntilServerReady方法 - 任何人都可以帮忙吗?如果它有帮助,服务器是本地的,我有一个System.Diagnostics.Process引用。

非常感谢,

Michael

At the critical point in my remoting client code, I know that the server process has started but I do not know that it is ready for a remoting call.  I want to write a WaitUntilServerReady method - can anybody help?  If it helps, the server is local and I have a System.Diagnostics.Process reference.

Many thanks,

Michael

推荐答案

在客户端,您可以使用同步调用简单地调用服务器端的方法。根据定义,同步调用在服务器响应之前不会返回,即阻塞。

你的意思是服务器在调用时可能不可用吗?即活化剂。 GetObject()可能会失败?在这种情况下,为什么不捕获异常,一段时间没有操作,并循环直到Activator.GetObject()成功?

On the client side, you can simply invoke the server side's method using a synchronous call.  By definition, synchronous call does not return until the server responds, i.e. blocking.

Do you mean the server might not be available at the time of calling?  i.e. Activator. GetObject() might fail?  In that case, why don't you catch the exception, no op for some time, and loop around until Activator.GetObject() succeeds?


这篇关于服务器准备好了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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