Getting error info when NSSocketPort initWithTCPPort fails
Getting error info when NSSocketPort initWithTCPPort fails
- Subject: Getting error info when NSSocketPort initWithTCPPort fails
- From: Rick Hoge <email@hidden>
- Date: Thu, 29 Jul 2004 14:19:28 -0400
I am using an NSSocketPort for a distributed objects connection, and in
certain environments, the following invocation returns nil
intermittently (about 50% of the time):
receivePort = [[NSSocketPort alloc] initWithTCPPort:SERVER_PORT];
When the return value is not nil, all works as expected (the port can
be used).
When I run this on machines at home, it works (returns non-nil) 100% of
the time - at work it returns nil at the 50% rate mentioned above. My
home network configuration is a PowerBook and a G5 connected by 100Mbit
ethernet switch which is also connected to an Airport base station (the
PowerBook also has Airport active). At work we have G5's each with two
network cards - one with static ip address on our university network
and a second card on a local network (both 100Mbits/sec).
In my testing I have been using SERVER_PORT values in the 10000 and up
range. Before I go further with this I have a few general questions:
- what are the possible causes of the nil return value? Is there any
way to get more error info?
- what is the best practice in this situation: upon failure should I
retry with a different port number until one works? Because it does
intermittently work, I could also just retry the same port number
several times...
Thanks for any suggestions - I've been trying to decide whether to post
this here or on email@hidden and decided on the Cocoa
list because that's the API I'm using...
Rick
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.