Dropped Connection Problems

B

Bill Atkins

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
 
A

Austin McDonald

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 [email protected](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
 

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,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top