I am de开发者_Go百科veloping a system which include a server app & a client app, note: the number of clients can be to million. These are my requirements:
- Client must authenticate (username & password) to server to be accepted connection. And client will listen to server, and receive any data which sent from server.
- When server has data, server will send to all connected clients.
Please help me some solution. Note: client is a WinForm application, and server is any kind of application which it can send data to all connected clients.
P/S: At the moment, my project use .NET Remoting but it is not suitable with my requirements because server can not send data to clients. I make a trick: Each client will send request to server each 2 seconds once to check that server has new data or no. If yes, client will receive data. I need a new solution to replace.
Thanks.
Take a look at Duplex WCF Services
Word of warning, this does not work over https.
Alternatively the Windows Azure Service Bus also supports Duplex communication.
Well you need to start by asking yourself and important question, is a 2 second poll interval really a requirement? Can you make it less frequent.
Do you in fact want to use frequent polling, or would you prefer to use another technique such as long polling (where a connection is held open until there is new data, then it is closed and recreated) or a true comet/PUSH setup where the connection is always open.
Another important question is how much load is this site going to be under, a few users? a hundred, a million?!
If you are using web services I think it can't be accomplished since it is always synchronous.
Have you looked at Jabber (XMPP)? Your need seems tailor-made i.e. you can trigger a send based on certain events etc. plus stateful data transfer etc.
精彩评论