From 31328e55fe15efa69bec9cfa3e2f5553011ab354 Mon Sep 17 00:00:00 2001 From: akr Date: Wed, 24 May 2006 05:06:59 +0000 Subject: [PATCH] update nonblocking methods document. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/socket/socket.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 5f4fe6abe8..7db06ef067 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -2286,7 +2286,10 @@ sock_connect(sock, addr) * socket.connect_nonblock( sockaddr ) * rescue Errno::EINPROGRESS * IO.select(nil, [socket]) - * socket.connect_nonblock( sockaddr ) + * begin + * socket.connect_nonblock( sockaddr ) + * rescue Errno::EISCONN + * end * end * socket.write( "GET / HTTP/1.0\r\n\r\n" ) * results = socket.read @@ -2623,6 +2626,10 @@ sock_recvfrom(argc, argv, sock) * The first element of the results is the data received. * The second element contains protocol-specific information * on the sender. + * + * When recvfrom(2) returns 0, Socket#recvfrom_nonblock returns + * an empty string as data. + * The meaning depends on the socket: EOF on TCP, empty packet on UDP, etc. * * === Parameters * * +len+ - the number of bytes to receive from the socket @@ -2745,7 +2752,7 @@ sock_accept(sock) * socket.listen( 5 ) * begin * client_socket, client_sockaddr = socket.accept_nonblock - * rescue Errno::EAGAIN + * rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR * IO.select([socket]) * retry * end