non-blocking TCPServer ?

L

leon breedt

hi,

maybe i'm understanding how this is meant to work incorrectly, but i
would have assumed TCPServer#accept would return immediately if i had
set it to nonblocking. the accept syscall on Linux would not have
blocked, according to the manpage..

require 'socket'
require 'io/nonblock'

s = TCPServer.new('localhost', 9000)
s.nonblock = true
s.accept
$stderr.puts "returned"


when i run this in a test script, accept blocks.

$ ruby -v
ruby 1.8.2 (2004-08-24) [i386-linux]

leon
 
Y

Yukihiro Matsumoto

Hi,

In message "Re: non-blocking TCPServer ?"

|s = TCPServer.new('localhost', 9000)
|s.nonblock = true
|s.accept
|$stderr.puts "returned"
|
|when i run this in a test script, accept blocks.

It shouldn't. I will fix.

matz.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top