问题
the clients will be able to chat one-to-one and in group (temperately rooms) similar to Skype.
I will use the server to authorize the clients
my question is which is better to go with?
(WCF) or (TCPClient, StreamReader, and StreamWriter)
cheesr
回答1:
I would vote for WCF also, as it will provide you with a common interface for doing a client/server architecture regardless of what protocol (binding) you choose behind the scenes. For example, you could very quickly make your chat program work across HTTP via SOAP with just a few configuration changes. WCF will also allow you to easily interoperate with clients written in different languages, but is optimised for .NET on both ends using the NetTcpBinding.
WCF will also work seamlessly with Visual Studio and is included in the .NET framework 3.0 and above, so no third party libraries will be required.
回答2:
I did not use WCF yet, but I can testify that TCPClient is a popular good start to do it, it works perfectly well, and you will find many ready-to-use examples all around the net. Besides, if you are beginning into networking, it is a good way to acknowledge the technology because you will know exactly what you are exactly doing and it will help you understand the basics of client/server technology.
On the other Side, WCF seems to be a lot more simplified and straightforward, but makes it difficult to see what goes on behind the scenes.
I suggest you try both with simple pieces of code and see for yourself, that's what I did every time I had technology alternatives to choose from, and this is IMHO the best way to make your own relevant decision.
回答3:
You will want to use WCF. No hassle with ports and listeners and you will probably need some of the features (Instance management, security) WCF provides.
回答4:
Go with WCF, WCF is good in wrapping the hard stuff, it presents those on a silver plate for you, the developer letting you focus on your program's logic.
I'm sure WCF can satisfy your program needs and more.
来源:https://stackoverflow.com/questions/4852493/multi-client-server-chat-program-in-c