We don’t allow questions seeking recommendations for books, tools,开发者_如何学C software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this questionI'm looking for a library / framework that would allow me to easily achieve this:
- Minimal message size (ideally something like - [16 bit message id] + [variable length message parameters]).
- Needs as little plumbing code as possible.
- TCP communication.
- Handles dozens of connections easily.
- Bidirectional communication.
I would like to use WCF-like approach, in which I would create contracts (operations and data) and would share that assembly with both clients and server. Or maybe there are some minimalistic bindings I could use - something even lighter than NetTcpBinding
?
Lidgren.Network is a very simple library which is easy integrated to any project. I've tried it out a little and it's very easy to use. Give it a try.
http://code.google.com/p/lidgren-network-gen3/
You might wanted to check out Photon http://www.exitgames.com/
For the protocol format, I would look into Google's ProtoBuffers. There are numerous languages supported, including C#. The serialization is small, wicked fast, extendable, and easily upgraded version over version.
As far as transport is concerned this can be more difficult. Frankly .NET's WCF is not up to the task. Raw TCP/IP built on Sockets is difficult to manage properly. Even building upon the TcpListener can prove difficult but it is possible.
So what's a good way to go? Well that is difficult to answer given the bi-directional requirement. I'm not sure I can point to any one library and say it has the right answer. There are several available and all have their strengths and weaknesses. A lot is going to depend on more specific requirements of your project. Good luck ;)
精彩评论