真正的Wcf双工通信,如何? [英] Real Wcf Duplex Communication ,How?
问题描述
嗨
我读了一些有关双工通信和使用回调的文章,但我的观察方式始终是这样的:OperationContract中使用的callBacks.因此,当客户端调用OperationContract时,服务会为客户端回呼.
但是我想要相反的情况.服务器发送请求,客户端应回答该请求.
在描述的wcf双工通信中,客户端请求服务,然后服务器使用回调向客户端发送一些通知.但是我希望服务器启动此过程并向客户端发送请求,然后客户端将答案发送到服务器.
现在我的客户每5秒检查一次新请求.
请帮帮我.
谢谢
Hi
I read some articles about duplex communication and using callbacks but the way i seen it, it was always like this: callBacks used in a OperationContract. so when a client calls a OperationContract, the service calls back for the client.
but i want the opposite situation. the server sends a request and client should answer it.
in the described wcf duplex communication client requests for a service, and server sends some notification to client using callback. but i want Server start this process and send a request to client,then client answer to server.
now my client checks for new requests every 5 sec.
please help me.
thanks
推荐答案
您也可以在这里阅读( ^ ]),此功能取决于您使用的传输协议.由于http使用了典型的请求重播方案,并且在大多数情况下,服务器无法访问在客户端打开用于侦听的端口,因此您只有这种轮询机制.但是,如果您的环境允许您使用TCP上的WCF,那么您将进行真正的双工通信.
As you can read also here (http://msdn.microsoft.com/en-us/library/cc645026(v=vs.95).aspx[^]), this functionality depend on the transport protocol you use. Since http uses a tipical request-replay scenario and in most cases the port opened for listening on client side would be inaccessible to the server, you have only this polling mechanism. But if your environment enables you to use WCF over TCP, than you will have a real duplex communication.
这篇关于真正的Wcf双工通信,如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!