LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Why does a multithreaded program gets hanged at recvfrom()? (https://www.linuxquestions.org/questions/linux-newbie-8/why-does-a-multithreaded-program-gets-hanged-at-recvfrom-373820/)

kranti 10-17-2005 02:40 AM

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

trickykid 10-17-2005 04:40 AM

Please do not post the same thread in more than one forum. Picking the most relevant forum and posting it once there makes it easier for other members to help you and keeps the discussion all in one place.

http://www.linuxquestions.org/rules.php


All times are GMT -5. The time now is 09:57 AM.