I have a Python app that uses UDP sendto/recvfrom with the socket.MSG_DONTWAIT flag. In Linux and Mac OS X, this works just fine. However, this flag doesn't exist in the Windows environment.
What is the equivalent flag in Windows? Alternatively, how can I do non-blocking sendto/recvfrom in Windows?
socket.setblocking(False) switches your socket into non-blocking mode on any platform. Call this once on socket creation, and you can remove all the MSG_DONTWAIT flags.
If you need to switch between blocking and nonblocking I/O (which is usually not the case), call socket.setblocking every time you want to switch between those two.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With