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:
- using threads single user receives data
- 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
Post a Comment