Suppose a application level protocol is implemented via UDP. Client timeout is required, thus server need to keep state of each client it talks to.
Also suppose select
is used.
Is it always the best to implement multi-threading server? I figure a link-list will do the same, where server timeout
time=Earliest Timeout of a client- CurrentTime
. A link-list will have the same function as keeping client's states, while avoiding the overhead of creating new threads(though introducing some complexity for server to maintain client-specific timeout).If multi-threading is chosen, then onward, is it the best to invoke new socket for new client? This will introduce system resource overhead. But I figure the default server socket (
bind
with server well-known port) will do the same since it got buffer (well..maybe not long enough for scalable num of clients..)
Thanks!