summaryrefslogtreecommitdiff
path: root/ext/socket/udpsocket.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/socket/udpsocket.c')
-rw-r--r--ext/socket/udpsocket.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/ext/socket/udpsocket.c b/ext/socket/udpsocket.c
index 2463c8325f..ae1f70eb10 100644
--- a/ext/socket/udpsocket.c
+++ b/ext/socket/udpsocket.c
@@ -218,8 +218,12 @@ udp_send(int argc, VALUE *argv, VALUE sock)
* s2.connect(*s1.addr.values_at(3,1))
* s1.connect(*s2.addr.values_at(3,1))
* s1.send "aaa", 0
- * IO.select([s2]) # emulate blocking recvfrom
- * p s2.recvfrom_nonblock(10) #=> ["aaa", ["AF_INET", 33302, "localhost.localdomain", "127.0.0.1"]]
+ * begin # emulate blocking recvfrom
+ * p s2.recvfrom_nonblock(10) #=> ["aaa", ["AF_INET", 33302, "localhost.localdomain", "127.0.0.1"]]
+ * rescue IO::WaitReadable
+ * IO.select([s2])
+ * retry
+ * end
*
* Refer to Socket#recvfrom for the exceptions that may be thrown if the call
* to _recvfrom_nonblock_ fails.
@@ -227,6 +231,10 @@ udp_send(int argc, VALUE *argv, VALUE sock)
* UDPSocket#recvfrom_nonblock may raise any error corresponding to recvfrom(2) failure,
* including Errno::EWOULDBLOCK.
*
+ * If the exception is Errno::EWOULDBLOCK or Errno::AGAIN,
+ * it is extended by IO::WaitReadable.
+ * So IO::WaitReadable can be used to rescue the exceptions for retrying recvfrom_nonblock.
+ *
* === See
* * Socket#recvfrom
*/