Dropped Connection Problems

Discussion in 'Ruby' started by Bill Atkins, Jun 7, 2004.

  1. Bill Atkins

    Bill Atkins Guest

    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
     
    Bill Atkins, Jun 7, 2004
    #1
    1. Advertising

  2. I've been looking at this, and I'm curious as to why you're using
    Socket#read rather than BasicSocket#recv or Socket#recvfrom. Of course,
    when I replace buff = @conn.read(6) with buff=@conn.recv(6), I get an
    IOError during the initialization of the BOS segment; I'm not sure why.
    Have you tried this yet, and if so why did you decide against it? Any
    idea why I'm having this error?

    On the other note, I've got a few months of experience with the OSCAR
    protocol; I spent last summer writing a packet parser for it. I'd be
    interested in helping you out.

    Austin McDonald

    Bill Atkins wrote:

    >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
    >
    >
    >
    >
     
    Austin McDonald, Jun 8, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. James J. Foster
    Replies:
    0
    Views:
    541
    James J. Foster
    Aug 7, 2003
  2. D A H
    Replies:
    1
    Views:
    1,607
    LenM22
    Jan 28, 2005
  3. Steffen Loringer

    Event if object is dropped out of the cache

    Steffen Loringer, Sep 28, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    380
    Kevin Spencer
    Sep 28, 2004
  4. Phil Jarvis
    Replies:
    2
    Views:
    844
    Sudsy
    Jul 7, 2004
  5. Paul Colton

    Exception in dropped connection...

    Paul Colton, Oct 23, 2003, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    128
    Paul Colton
    Oct 23, 2003
Loading...

Share This Page