Multithreaded client server problem
I am facing a peculiar problem with my clients server application. I have written a console based multithreaded client server. Multiple Client try to send and receive data thousand times. When i run more than one client, my old client stops sending receiving data and new client starts operation. I am unable to understand why my first client gets blocked when i start another client.
Re: Multithreaded client server problem
You probably have an error in your code.
Seriously, what else can we guess/surmise, based on the meager description that you provided.
The error might lie with the server, in that the server stops servicing older clients when a new client arrives. Go to the "Multithreaded Server" example at http://tangentsoft.net/wskfaq/exampl...ed-server.html and compare your code to the sample
Mike
Re: Multithreaded client server problem
i'll tell you whats your problem
since you got multiple clients, you need multiple FD's to set
if you don't set the FD on the client (server-side talking) and try to send( ) on that socket, it will not work.
what you need to do is enumerate all your clients into a container and set the FD's on their socket and have a variable to define the number of fd's you have totally set.
after that you can try to select( ) on all the sockets (easiest way)