hi, all
i m trying to code Client server model in C++.
Do we need a thread to handle a client means per client a thread is to be generated. Is there any other way so that we can handle more numbers of clients with some limited threads?
Printable View
hi, all
i m trying to code Client server model in C++.
Do we need a thread to handle a client means per client a thread is to be generated. Is there any other way so that we can handle more numbers of clients with some limited threads?
You don't need a new thread for each client. But if you use synchronous functions you should create one extra thread for the whole network communication, because otherwise your main thread will be blocked.
Further more Winsock offers some interesting I/O models that help applications manage communication on one or more sockets at a time in an asynchronous fashion: select, WSAAsyncSelect, WSAEventSelect, overlapped I/O, and completion port. Search Information regarding these models on Internet and in MSDN it may helps u.