Hey, I have a minor problem with my IRC bot. It disconnects every while
and then, often with a few days in between. My problem lies in the
reconnecting procedure. The bot does not notice when it has been
disconnected. I have tried Socket.closed?, time-out timer for the select
IO. Nothing seems to work.

Any idea why?

//Walle

[/code]
def loop()
  while !@connection.closed?
    ready = select([@connection, $stdin], nil, nil, 10)
    next if !ready
    ready[0].each do |message|
    if(message == $stdin)
      return if $stdin.eof
      message = $stdin.gets
      send(message)
    elsif(message == @connection)
      return if @connection.eof
      message = @connection.gets
      data_response(message.strip)
    end
    end
  end
    raise Errno::EPIPE
  end
[/code]
-- 
Posted via http://www.ruby-forum.com/.