I use nonblocking UNIX UDP socket to transfer data from one process to another:
audio_s = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
audio_s.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 5500000)
audio_s.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, 5500000)
audio_s.setblocking(0)
try:
os.remove(SOCKET_PATH)
except FileNotFoundError as e:
pass
audio_s.bind(SOCKET_PATH)
And I often send data to remote process:
audio_s.sendto(data, REMOTE_SOCKET_PATH)
But sometimes (very rare) I catch BlockingIOError: [Errno 11] Resource temporarily unavailable
on sendto
call. What reason can be for this? Resource temporarily unavailable
looks like very generic sentence.
- Is it possible to know more detailed information? For example send buffer overflowed of remote receive buffer overflow? Are these possible reasones? or only 1 of them?
- Can I control current datagram count in send/receive buffer?
- What is correct way to process or avoid this situation?
If I remove line with:
audio_s.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, 5500000)
it works without this exception