multiple clients - one server connection with sockets tcp/ip c# .net

Posted by jagse on Stack Overflow See other posts from Stack Overflow or by jagse
Published on 2010-05-19T14:26:03Z Indexed on 2010/05/19 15:10 UTC
Read the original article Hit count: 209

Filed under:
|
|
|
|

Hello guys, I need to develop a client server system where I can have multiple clients communicating with one server at the same time. I want to communicate xml serialized objects and also need to send and receive other commands to invoke methods. Now, I am just starting with socket programming in C# and .Net and found that the asynchronous I/O is the way to go so that the methods dont block the execution of code. Also there are many examples of how to

make a simple client server system. So I have a basic understanding of how that works.

Anyway, what still is not clear to me is how I can set up a server which can manage connections to multiple clients? Can I just create a new socket per connection and then store those in some kind of list? Do I need some kind of multiplexing to achieve this? Do I have to listen at multiple ports? What`s the best way here?

And the other thing is if I need to develop my own protocol to differentiate between what I am actually sending over the network --> xml serialized object or a command which might be just a string encoded in ascII or something. Or would I develop my own protocol just to send these commands?

Any kind of help is apreciated! If someone knows a good book which covers this sort of stuff, let me know. Cheers

I forgot to mention that some of my clients which are supposed to communicate with my server will be pda and I therefore use the compact framework... So this might bring in some restrictions...

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET