Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys,

How can I tell if a socket is blocking or non-blocking in C++ and in windows API?

Thanks,
AR
Posted

1 solution

Depends on how you used the socket.
When it is blocking, the execution of the current thread stays in the "usage-function" of that socket until that function returns. Or, your program is "blocked" until the socket-operation finishes.
When it is not blocking, it begins parallely with the execution of the socket-functionality you called while your current thread continues to run.
 
Share this answer
 
Comments
Alexeirob 6-Dec-10 11:01am    
Ok, let me rephrase my question. I have a handle to a socket (in C++), and I want to check if it's blocking or not.
I know how to set it: http://msdn.microsoft.com/en-us/library/ms738573(VS.85).aspx
But I need to get this property.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900