On Jul 22, 2008, at 10:46 AM, Chris Backas wrote:

So... the problem is that when I try to reconnect to DO, meaning, call getServerProxy the second time, I get an exception from the DOConnection = [[NSConnection connectionWithReceivePort:nil sendPort:DOConnectionSocket] retain]; line.

The exception:
*** -[NSCFArray insertObject:atIndex:]: attempt to insert nil

The backtrace:
#0  0x971f30d7 in objc_exception_throw ()
#1  0x94fc3f2b in +[NSException raise:format:arguments:] ()
#2  0x94fc3f6a in +[NSException raise:format:] ()
#3  0x900ea3d0 in _NSArrayRaiseInsertNilException ()
#4  0x90008a04 in -[NSCFArray insertObject:atIndex:] ()
#5  0x90008914 in -[NSCFArray addObject:] ()
#6  0x90027d2d in -[NSConnection addRunLoop:] ()
#7  0x90027b8f in -[NSConnection initWithReceivePort:sendPort:] ()
#8 0x90042df7 in +[NSConnection connectionWithReceivePort:sendPort:] () #9 0x001ecae7 in -[FourDForwarder getServerProxy] (self=0x6be210, _cmd=0x1f401c)
*snip*

The exception is internal, but I have to think that it's occurring because of some state I'm not appropriately cleaning up when I disconnect. I just can't think what that would be. It's related to runloops based on the backtrace, and the NSConnection documentation says that it tries to register with the "Current" run loop. NSRunLoop's documentation says that if you ask for the current run loop and there isn't one, one will be created though... So I can't see a situation where it would be trying to add a nil run loop.

Any ideas?

I suspect that DOConnectionSocket is nil. Have you tried logging it? While you're at it, try logging the arguments to the initialization of that port object: the port and host.

Is anything written to the stderr/stdout/console immediately prior to this exception?

If the LAN connection was temporarily disconnected, it may be that you're having a domain name resolution failure. Also, you can try using NSHost and/or SCNetworkCheckReachabilityByName to see if the system believes the remote host is "reachable" (for a certain limited meaning of that term; it just means, does the local host know how to route attempts to communicate with that remote host?).

Cheers,
Ken
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to