vendredi 28 octobre 2016

Which of poll() and multi-thread with blocking recv() uses less resources?

I am trying to build a simple web server with just c++11 and those socket libraries.

I think there are two options for me: poll() and multi-thread with blocking recv().(Let me know if you know other options)

  1. poll() can be just single thread. But the while loop can be quite messy. But you won't encounter a lot of thread-related problem.
  2. So I tried multi-thread with blocking recv() and set recvtimeo. It looks not bad. But I am just curious will this method cost more resources?

Aucun commentaire:

Enregistrer un commentaire