git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2008-10-09 00:46:59 +00:00
Родитель 8fe2011e35
Коммит f59b1dfbfb
1 изменённых файлов: 7 добавлений и 7 удалений

Просмотреть файл

@ -772,7 +772,7 @@ bsock_recv(int argc, VALUE *argv, VALUE sock)
* c = TCPSocket.new(addr, port) * c = TCPSocket.new(addr, port)
* s = serv.accept * s = serv.accept
* c.send "aaa", 0 * c.send "aaa", 0
* IO.select([s]) * IO.select([s]) # emulate blocking recv.
* p s.recv_nonblock(10) #=> "aaa" * p s.recv_nonblock(10) #=> "aaa"
* *
* Refer to Socket#recvfrom for the exceptions that may be thrown if the call * Refer to Socket#recvfrom for the exceptions that may be thrown if the call
@ -1598,7 +1598,7 @@ tcp_accept(VALUE sock)
* === Example * === Example
* require 'socket' * require 'socket'
* serv = TCPServer.new(2202) * serv = TCPServer.new(2202)
* begin * begin # emulate blocking accept
* sock = serv.accept_nonblock * sock = serv.accept_nonblock
* rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR * rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR
* IO.select([serv]) * IO.select([serv])
@ -1899,7 +1899,7 @@ udp_send(int argc, VALUE *argv, VALUE sock)
* s2.connect(*s1.addr.values_at(3,1)) * s2.connect(*s1.addr.values_at(3,1))
* s1.connect(*s2.addr.values_at(3,1)) * s1.connect(*s2.addr.values_at(3,1))
* s1.send "aaa", 0 * s1.send "aaa", 0
* IO.select([s2]) * IO.select([s2]) # emulate blocking recvfrom
* p s2.recvfrom_nonblock(10) #=> ["aaa", ["AF_INET", 33302, "localhost.localdomain", "127.0.0.1"]] * p s2.recvfrom_nonblock(10) #=> ["aaa", ["AF_INET", 33302, "localhost.localdomain", "127.0.0.1"]]
* *
* Refer to Socket#recvfrom for the exceptions that may be thrown if the call * Refer to Socket#recvfrom for the exceptions that may be thrown if the call
@ -2187,7 +2187,7 @@ unix_accept(VALUE sock)
* === Example * === Example
* require 'socket' * require 'socket'
* serv = UNIXServer.new("/tmp/sock") * serv = UNIXServer.new("/tmp/sock")
* begin * begin # emulate blocking accept
* sock = serv.accept_nonblock * sock = serv.accept_nonblock
* rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR * rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR
* IO.select([serv]) * IO.select([serv])
@ -2560,7 +2560,7 @@ sock_connect(VALUE sock, VALUE addr)
* include Socket::Constants * include Socket::Constants
* socket = Socket.new(AF_INET, SOCK_STREAM, 0) * socket = Socket.new(AF_INET, SOCK_STREAM, 0)
* sockaddr = Socket.sockaddr_in(80, 'www.google.com') * sockaddr = Socket.sockaddr_in(80, 'www.google.com')
* begin * begin # emulate blocking connect
* socket.connect_nonblock(sockaddr) * socket.connect_nonblock(sockaddr)
* rescue Errno::EINPROGRESS * rescue Errno::EINPROGRESS
* IO.select(nil, [socket]) * IO.select(nil, [socket])
@ -2916,7 +2916,7 @@ sock_recvfrom(int argc, VALUE *argv, VALUE sock)
* socket.bind(sockaddr) * socket.bind(sockaddr)
* socket.listen(5) * socket.listen(5)
* client, client_sockaddr = socket.accept * client, client_sockaddr = socket.accept
* begin * begin # emulate blocking recvfrom
* pair = client.recvfrom_nonblock(20) * pair = client.recvfrom_nonblock(20)
* rescue Errno::EAGAIN, Errno::EWOULDBLOCK * rescue Errno::EAGAIN, Errno::EWOULDBLOCK
* IO.select([client]) * IO.select([client])
@ -2984,7 +2984,7 @@ sock_accept(VALUE sock)
* sockaddr = Socket.sockaddr_in(2200, 'localhost') * sockaddr = Socket.sockaddr_in(2200, 'localhost')
* socket.bind(sockaddr) * socket.bind(sockaddr)
* socket.listen(5) * socket.listen(5)
* begin * begin # emulate blocking accept
* client_socket, client_sockaddr = socket.accept_nonblock * client_socket, client_sockaddr = socket.accept_nonblock
* rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR * rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR
* IO.select([socket]) * IO.select([socket])