Should I use blocking or non-blocking sockets?
Blocking and non-blocking refer to how internet connections are made and operated by applications.
- Blocking. Using a blocking socket the program will not resume execution until the socket operation has completed. This means that if your application sends data, the application will wait until all the data is sent before it continues. Unless the application is multi-threaded, it can’t do anything else while the data is trasmitted down a link like a modem. Further more, the application can only do actions in series – that is read, write, etc.
- Non-blocking. Using a non-blocking socket means that the application can request that data is sent and continue to do other processing. Further, the application can write data to an internet link and proceed to read data from it at the same time. Clearly this gives the application a great deal of control and performance benefits.
Gordano products are all multi-threaded and can therefore work in blocking or non-blocking mode. There is little performance impact when the load is medium to light. For higher load situations, Gordano recommends using
non-blocking sockets (this is the default). For most users, there will never be a reason to change this default setting.
You may choose to change to blocking sockets due to issues that have been discovered with the way that IE Versions 5 and 5.5 manage connections. See Knowledge Base Entry 425 for more details.
Keywords:sockets, blocking, non-blocking