I'm working on a design for my new application and I need to make a decision what sort of communication is best for Silverlight client and a server. (it could be a winform app or a web app)
Couple of main points:
- Multiple Silverlight clients will connected to the Server.
- Most of the client-to-client communication will go through the serve开发者_JAVA百科r anyway, but it would be good to hear about P2P options.
- I know my networking options are: Sockets, Web Service, WCF Service but which one would be best for heavy communication between client and the server. (lets call it constant bandwidth of 50 kbps) .
It is also important that response time (network lag) is as low as possible.
Nothing will beat the performance of plain old TCP sockets with binary serialization of your data.
UDP is even faster, but it is only suitable in certain scenarios eg. where you don't mind losing the odd packet, and you don't care about the order of packets arriving in the order you sent them.
Web Services add a lot of overhead due to XML/SOAP serialization, plus HTTP. I'd guess you could be looking at an order of magnitude more data crossing the wire when using Web Services vs sockets with binary data.
WCF has some good options for peer to peer but would require you to use the full framework, not silverlight. Have a look at PeerChannel
精彩评论