RMI应用程序
我想编写一个 RMI 应用程序,服务器能够运行不同的程序,例如客户端中的媒体播放器,甚至关闭它们。我该怎么做?
i want to write a rmi application which the server has the ability to run different programs like media player in the client, and even shut them down. how can i do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过向服务器公开客户端回调来做到这一点(在这个意义上,客户端也充当服务器),以便响应某些事件,服务器可以影响客户端行为。
查看此示例了解客户端回调。
一个非常常见的架构是通过使用观察者模式获得的 - 请参阅 RMI 示例如下。
PS如果您有针对媒体播放器的问题,您应该将其放在一个单独的问题中,这将提高您获得更具体答案的机会。
You can do this by exposing client callbacks to the server (the client behaves as a server too in this sense), so that in response to some events the server can affect the client behavior.
Have a look at this example for client callbacks.
A pretty common architecture for this is obtained through the use of the observer pattern - see an RMI example here.
P.S. If you have questions specific to media-players you should put that in a separate question, this will improve your chances to get a more specific answer.