LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-31-2010, 04:12 AM   #1
barunparichha
Member
 
Registered: Jun 2006
Location: Bangalore,india
Distribution: Linux(Redhat,fedora,suse,ubantu), Solaris (s8/s9/s10/nevada/open-solaris)
Posts: 303

Rep: Reputation: 32
blocking socket Vs non-blocking socket


My question is quite simple:
What are type of applications where socket in blocking mode can be used ?
And where non-blocking mode to be used ??


TCP is blocking by default.

When we are in non-blocking mode, it's a must to check the return values of send and rev, because we might not be able to send/recv the entire chunk of data in single shot.
 
Old 03-31-2010, 04:16 AM   #2
jayasekar
Member
 
Registered: May 2008
Posts: 39

Rep: Reputation: 16
hi barunparichha,
Have a look at http://www.developerfusion.com/artic...on-to-tcpip/8/
 
Old 03-31-2010, 04:31 AM   #3
barunparichha
Member
 
Registered: Jun 2006
Location: Bangalore,india
Distribution: Linux(Redhat,fedora,suse,ubantu), Solaris (s8/s9/s10/nevada/open-solaris)
Posts: 303

Original Poster
Rep: Reputation: 32
Can we summarize some situation/env to use blocking/non-blocking mode ?

Bccause in real industry env, it's always to trade off between blocking and non-blocking mode.
 
Old 03-31-2010, 10:15 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,364

Rep: Reputation: 2752Reputation: 2752Reputation: 2752Reputation: 2752Reputation: 2752Reputation: 2752Reputation: 2752Reputation: 2752Reputation: 2752Reputation: 2752Reputation: 2752
If each incoming msg requires a one-shot (short) piece of processing, then finish, then blocking makes sense. Also if the receiver is a serial worker ie the business requirement only processes msgs in order, then blocking.

If the receiver is also monitoring ongoing processing eg child worker processes, then non-blocking is good. Also if processing incoming msgs in parallel is allowed.
 
  


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
blocking socket Vs non-blocking socket barunparichha Linux - Software 2 04-02-2010 07:38 AM
Help with non blocking udp socket mhogue Programming 2 02-04-2010 02:07 AM
Help with Non Blocking UDP Socket mhogue Programming 1 02-02-2010 05:39 PM
socket blocking problem pervert Programming 4 05-21-2006 01:28 PM
C socket non-blocking bob66 Programming 1 03-13-2005 10:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:57 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