开发者

How to build a messaging system in .NET?

I'd like to write a program where you can have 2 clients that talk to each other in realtime. I've been looking into WCF services and Duplex messaging, data contracts etc but now 开发者_如何学运维I'm confused.

Basically I see it as:

[Client] --- msg --> [Server] --- msg --> [Client] and vica versa.

The server will just act as the messenger.

Could you please point me in the right direction? I'd like to use WPF for the client apps.


Check out the WCF peer-to-peer programming paradigm. It will be extended in WCF 4 (with .NET 4 - due out April 12, 2010) by allowing dynamic discovery (and article here) of other clients on your network.


This should help get you going: WCF / WPF Chat Application


Perhaps Windows Azure Service Bus (which uses WCF) might be worth a look?

Service bus can effectively be used as a message bus, which is one way to implement what you are describing.


I can think of two scenarios

  1. The clients are the only ones that start a request, to send they push messages and to receive they request periodically for new messages. The main advantage of this architecture is that it is more firewall-proof.

  2. The clients are also servers that receive messages relayed by the central server. The main advantage is that the clients receive updates faster and they save bandwidth.


I wrote program like your sample!!! but it has one big different: My program have a chat server and a client. clients can chat to others.(with chat server service)

This program use two wcf service for make a connection between client and server.(client call server and send message for it,server get message from client and send for all client have connected to server)I think u used one service and must be use two service(like me) or use Duplex Service.

The sucha barber`s example is too cool(WCF/WPF Chat Application in answer eric). He used duplex services but real problem of this example is "sucah used WPF too and it s expert example for beginners (like me and u)".

If u want i can share my program!!!

seethis

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜