假设我想编写一个点对点聊天应用程序。我使用 WCF 服务作为客户端“登录”的服务器,以便它们可以找到彼此的 IP 地址和端口。
好吧,还说我的客户端应用程序中有一个文本框,显示所有在线用户。每次用户登录或注销时,我想更新此“谁在线”文本框,以便仅显示当前在线用户。
因此,一旦用户登录或退出,服务器需要向所有客户端发送信息。但似乎WCF只能在响应请求时发送数据......
我在这里遗漏了什么吗,WCF能够处理这种情况吗?
Say I want to write a peer to peer chat application. And I use a WCF service as the server that the clients 'log in' to so that they can find each other's ip addresses and ports.
Well, say also I have a textbox in my client application that display all users that are online. Everytime users log in or out I want to update this 'Who's online' textbox so that only the currently online users are shown.
So the server needs to send information out to all clients once a user logs in or out. But it seems WCF can only send data when responding to requests....
Am I missing something here, is WCF able to handle this situation?
发布评论
评论(2)
有多种方法可以解决此问题,这些可能是最常见的:
There are several approaches to this problem, these would probably be the most common:
我认为您需要双面打印服务。
I think you need a duplexing service.