c++ - (Sockets) Better to use thread or loop for receiving data? -


currently i'm developing server application multiple user able join. so, i'd recv data of user. there 2 ways solving problem:

  1. using threads single user receives data
  2. using 1 thread iterator receives data of user saved in list.
       int singleuserthread(socket client) {     recv(...);     }   

or

       int onethread() {         std::vector clientlist;          for(std::vector::iterator = clientlist.begin();                 != clientlist.end(); it++) {             recv(*it ...);         }      }   

which way should use? more efficient?


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -