Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


Closed Thread
  Search this Thread
Old 10-17-2005, 02:40 AM   #1
LQ Newbie
Registered: Oct 2005
Location: Pune
Posts: 17

Rep: Reputation: 0
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?


Old 10-17-2005, 04:40 AM   #2
LQ Guru
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 255Reputation: 255Reputation: 255
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.

Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why does a multithreaded program gets hanged at recvfrom()? kranti Programming 1 10-17-2005 10:44 AM
Why does a multithreaded program gets hanged at recvfrom()? kranti Linux - General 1 10-17-2005 04:09 AM
Probelm regarding multithreaded program? geethu Programming 2 08-10-2005 12:39 AM
Debugging Multithreaded Program villie Programming 2 08-17-2004 11:24 AM
Signal handling in Multithreaded program souvik Programming 4 08-23-2002 07:28 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:46 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration