Reputation: 2754
I have developed a single server multiple client udp application using multithreading. I want to switch to a single processor system now so multithreading will no more help me :(
Now I want to implement the server using asynchronous sockets so that it may be able to handle multiple clients at a time.
Will this approach work fine? Is it correct to use asynchronous socket if you want to handle multiple clients using one single server? Is using asynchronous socket a better approach than using threads for handling multiple clients?
Upvotes: 1
Views: 441
Reputation: 1328
I would recommend you to take a look at libevent: http://www.libevent.org/ it provides all necessary functions to organize asynchronous servers.
Upvotes: 2
Reputation: 7798
You could multithread the server just as well as make it asynchronous. Unless you have a LOT (100s/1000s) of connections you probably won't notice the performance difference of any of the approaches to multiplexing your connections. select/poll, threading, aio will all perform about the same for a low number of connections. aio is harder to implement solidly though.
Upvotes: 1