From: Tanaka Akira Date: 2004-11-27T10:56:21+09:00 Subject: Re: [ANN] Multiplexer - linear non-blocking I/O In article <024601c4d40a$674fc8e0$6442a8c0@musicbox>, "Bill Kelly" writes: > I've always used send/recv for my socket I/O. I *think* I don't > have a problem with blocking, even without NONBLOCK set. (Excepting > rare circumstances as are possible with accept(), etc.) > > Does that sound right? Or should I be seeing blocking problems > even using send/recv ? You'll see blocking problem with send when you send huge data. Linux man page of send(2) says: | When the message does not fit into the send buffer of the socket, send | normally blocks, unless the socket has been placed in non-blocking I/O | mode. In non-blocking mode it would return EAGAIN in this case. The | select(2) call may be used to determine when it is possible to send | more data. Try: require 'socket' require 'fcntl' server = TCPServer.new 12345 t_a = Thread.start do a = server.accept data = "foo" * 10000000 a.send data, 0 a.close end b = server.accept b.send "b", 0 b.close t_a.join -- Tanaka Akira