I'm working on a Ruby library to connect to AOL AIM servers with the
OSCAR protocol.  The client works fine, but after a minute or so the
server drops my connection.  I don't get any notification about this,
I just get the following error:

../oscar/flapmgr.rb:28:in `get': undefined method `unpack' for
nil:NilClass (NoMethodError)
        from ./oscar/snacmgr.rb:61:in `get'
        from ./oscar/connection.rb:25:in `process'
        from ./oscar/session.rb:53:in `tick'
        from ./oscar/session.rb:52:in `each'
        from ./oscar/session.rb:52:in `tick'

The code in question is:

  class FLAPManager
    def get
      buff = @conn.read(6)
      header = buff.unpack("CCnn")

      ...
    end

When the connection is dropped, Socket#read just returns nil.  Why is
this?  Is there any way to have an exception raised when a server
drops a connection.  When a client breaks a connection to a server,
the server gets an exception, so I don't see why this wouldn't be
possible.

On another note, if anyone out there has any experience with the OSCAR
protocol, I would greatly appreciate any assistance you could give me.
 The source is available in CVS at
http://rubyforge.org/cgi-bin/viewcvs/cgi/viewcvs.cgi/oscar/?cvsroot=oscar
..  Everything works _perfectly_ until the server suddenly drops my
connection.  I'd really like some help with this.

Thanks in advance,
Bill Atkins