|
require "socket"
|
|
|
|
if !IO.instance_methods.include?(:ready?)
|
|
class IO
|
|
def ready?
|
|
!IO.select([self], nil, nil, 0).nil?
|
|
end
|
|
end
|
|
end
|
|
|
|
|
|
class IO
|
|
def readable?
|
|
!IO.select([self], nil, nil, 0).nil?
|
|
end
|
|
|
|
def writable?
|
|
!IO.select(nil, [self], nil, 0).nil?
|
|
end
|
|
end
|