Threaded recv() Blocks Indefinitely if no Data Available (106479)
The information in this article applies to:
- Microsoft LAN Manager 2.2
This article was previously published under Q106479 SYMPTOMS
The LAN Manager 2.2 SOCKDRV.OS2 sockets call recv() will block indefinitely
if data is not available in the receive window when called from a separate
thread.
CAUSE
Socket data structures are allocated on a per-process basis. When the first
thread calls recv() and blocks, flags are set to indicate this. When the
second thread calls send() the socket's flags are reset, losing the state
information on the blocked recv. This is a classic case of one thread
stomping on another by means of the shared data segment.
STATUS
This behavior is by design. The problem is avoided if multi-threaded
applications send() and recv() on separate sockets.
MORE INFORMATIONSTEPS TO DUPLICATE CONDITION
If you want to demonstrate this problem, write an application that calls a
thread that issues a recv() and then sends data to itself on the same
socket.
Modification Type: | Major | Last Reviewed: | 9/30/2003 |
---|
Keywords: | KB106479 kbAudDeveloper |
---|
|