multithreading - C# MMO server structure -


i @ beginning of writing simple mmo server demo game. using udp protocol (udpclient) wonder, how other servers working?:

  1. only 1 udp client process connected clients , messages , responds them
  2. server creates new udp client instance each connected player?

i have tested connecting 50 clients send "ping" message , server has reply "pong". takes 10 seconds (on localhost) 50th "pong" send (in mean time, server supposed send ping 1st player queue can prolonged hours absurd)

other servers use 1) i.e. listen client 1 socket (of assume there 1 per udpclient) . furthermore:

  • this 1 socket should used lifetime of server, i.e. don't create new 1 when done 1 datagram.
  • receives , sends should done asynchronously receiving/sending 1 stream doesn't hold receiving/sending stream.
  • beware of amount of data send/receive - if send/receive data several clients server total amount of data multiplied amount of clients.

doing above on localhost 50 clients sending ping , receiving pong few bytes should take less 1ms, assuming other process not maxing out processors.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -