Skip to main content
gamedev.net
🔒 Locked

The best method?

Started by Gogeta70 0 replies 1.2k views
Original Post
Gogeta70
Gogeta70
Hey everyone. I'm programming an anti-cheat client & server that features a ventrillo-like voice chat system. The client is made on windows, and the server is made on linux. I'm having a problem with the client maintaining a connection to the server, so i'm thinking that maybe my method for handling connections is wrong. My question to you is this:

What is the best method for handling a high volume of connections on a server? I've heard that select() is pretty slow. Right now i have the sockets set to non-blocking and i'm checking each socket with recv() in a loop, and creating a new thread to handle incoming data.

Thanks in advance.
rip-off
rip-off
It depends on your definition of "high volume". You seem to be talking about number of users, but with voice in the mix bandwidth could become a limiter too.

Have you read Q11 of the Forum FAQ?

A "thread per client" is usually an expensive way of handling connections. Although it sounds like you're receiving in a non-blocking fashion, then handing off just that data to a new thread? That sounds very expensive to me. A blocking select should consume less processor time, and you probably would be better off avoiding creating new threads often.

Where did you hear that select() is slow? It is typically the simplest and performs adequately for a wide variety of uses.

Have you considered offloading/delegating the voice chat, rather than trying to manage it all on one server? For example, you might be able to use the anti-cheat server as a introducer, and allow the clients to send the voice chat directly between one another.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.