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. |
hi barunparichha,
Have a look at http://www.developerfusion.com/artic...on-to-tcpip/8/ |
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. |
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. |
All times are GMT -5. The time now is 08:38 PM. |