efficient server in c#

  • Thread starter Thread starter Rob
  • Start date Start date
R

Rob

Hi,

I would like to write game server in c#. It's rather easy and slow game,
not quake5 ;)
But I don't want to create a new threat for each connection, because I
would like to write good server. (I afraid do huge number of threads..)
Which class for connection should I use ? (for server and client)

Thanks for help
 
Hi,

I would like to write game server in c#. It's rather easy and slow game,
not quake5 ;)
But I don't want to create a new threat for each connection, because I
would like to write good server. (I afraid do huge number of threads..)
Which class for connection should I use ? (for server and client)

Personally, I'd just go ahead and use the Socket class. But, if for some
reason you find it easier to understand TCP as a Stream instance, or
otherwise want to use the minor additional features found in the TcpClient
and/or UdpClient classes, those would be appropriate as well.

Either way, you will have available to you the usual .NET asynchronous
pattern (methods named "Begin..." and "End..."), which is what you should
use rather than dedicating a thread for each connection. That will give
you a maintainable, efficient solution.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top