LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-29-2006, 10:01 AM   #1
arunka
Member
 
Registered: Mar 2005
Posts: 60

Rep: Reputation: 15
recv() is not coming out of blocking after closing the socket.


Hi All
I have a server which is mutithreaded.
One of the thread is blocking on recv(),
If from another thread i close the socket, the recv() is not coming out of blocking.
If i do the same in windows it is working correctly.
Can anyone help??

Thanks in advance
Arun KA
 
Old 06-30-2006, 09:07 PM   #2
Peterius
Member
 
Registered: May 2004
Distribution: Gentoo, Debian, OpenBSD, NetBSD
Posts: 158

Rep: Reputation: 16
Is the close successful? There might be something like a usage count on the file handle for the socket and until its 0 the socket remains open. Each thread might add to that usage count. I haven't done this stuff in a while but chances are your code needs to be rewritten to get the desired effect. Post a little more information about what you're trying to do and the situation perhaps?
 
Old 06-30-2006, 09:52 PM   #3
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
I'm not sure offhand, but the behavior could be due to the differences in thread semantics between Windows and Linux. You could set the file descriptor nonblocking and periodically check and make sure that the file descriptor hasn't been closed.
 
  


Reply



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
socket blocking problem pervert Programming 4 05-21-2006 01:28 PM
recv() function of SOCKET ashucool83 Programming 1 10-08-2005 07:38 PM
C socket non-blocking bob66 Programming 1 03-13-2005 10:21 AM
function recv() in socket husniteja Programming 1 08-18-2004 09:06 AM
Closing Socket in MultiThreaded Application Fails laalitseth Red Hat 0 04-21-2004 12:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:53 PM.

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