Archived

This topic is now archived and is closed to further replies.

Lysandius

UDP Server Design

Recommended Posts

Hi there! I''m making a server application that used UDP. It should handle over 1000 clients. One way of handling multiple clients with UDP is create one socket that receives all datagrams. I would just have to take a look at the address structure to see which client has sent it. A second way would be to create multimple sockets, each on a different port and then use TCP concurrent server techniques (IOCP, RT Signals, select(), ...) for checking each socket. Are there other ways? I''d like to have different sockets on the same port where each socket receives and sends datagrams from and to one client. I don''t know how to do this. I hope someone does. Thanks! Lysandius

Share this post


Link to post
Share on other sites
it would be severely innefficient to have a seperate socket for every client in a UDP architecture, esp. for 1000+ clients. as u mentioned, it would be easier (more efficient) to identify clients based on address and port.

having the OS notify you when there is data available on a socket (i.e. select(), signals) is relatively slow. you might want to look into non-blocking sockets. if your server app doesn''t have to be blazing fast, select() or something similar might be fine if u don''t have *too* many clients at the same time.

Share this post


Link to post
Share on other sites
Check this post:

http://www.gamedev.net/community/forums/topic.asp?topic_id=148480

As for the UDP sockets the first way you described is the most common and i would recommned you using it. You can easily make it effectively cope with the task.

"I''ll be Bach!" (c) Johann Sebastian Schwarzenegger

Share this post


Link to post
Share on other sites