My first online Managed DirectX game
Hello,
I'm making my first turn-based game in C#.
Im using the lidgren network library:
http://code.google.com/p/lidgren-library-network/
Im a little puzzled about what's the best way to process incoming network messages.
My idea is to let 2 threads handle the network (one for listening - one for sending messages) and make a thread pool that I use to process each network message or request that I get. There is a question how big this thread pool should be and if I need some kind of locking mechanism (mutex) to allow only one thread at a time to be allowed access my game's ruleset.
Would you recommend doing this any differently?
I've been thinking.
Isn't it better for the server to put incoming requests in a queue? (instead of using multiple threads)?
Isn't it better for the server to put incoming requests in a queue? (instead of using multiple threads)?
I would recommend against threading and just use an application loop, polling messages and handling them as they arrive. Also; posting in the network or .net forum would probably give more answers.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement