Why does a multithreaded program gets hanged at recvfrom()?
I have written a client-server application using multithreading.
Initially I'm creating a thread to receive client requests in server. But only if the queue has registered clients, the code inside the thread will get executed.
Hence for the FIRST client-request,
I'm sending a buffer containing some pre-defined request to the server thru' client. But at server side, the program gets hanged at the first recvfrom() function call after the thread creation, in main() while at client side I'm able to perform recvfrom() and sendto() although there is problem at server side.
The flow goes like this when I try to debug....
Client: sendto() OK
Server: recvfrom() control gets stuck-up at this point
Server: sendto() ---
Client: recvfrom() OK
Client: sendto() OK
Server: recvfrom() ---
Server: sendto() --- this is inside another thread
Client: recvfrom() hang
How can the client communicate well if server is getting blocked?
Thanks,
Regards,
Kranti
|