Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1269

Python • Re: UDP sendto blocks code execution when the interface is down

$
0
0
I'm not certain if this will solve it, but you could try adding the MSG_DONTWAIT flag. See the send(2) manpage for details.

Code:

sock.sendto(bytes, socket.MSG_DONTWAIT, address)
N.B. the underlying Linux syscall will return EAGAIN or EWOULDBLOCK if it would block, which I'm guessing will turn into a Python exception that you will need to catch.

See also https://docs.python.org/3/howto/sockets ... ng-sockets, there might be something in there which you find useful.

Statistics: Posted by Murph9000 — Wed Aug 28, 2024 2:39 pm



Viewing all articles
Browse latest Browse all 1269

Trending Articles