Re: Closing Distributed Object connections
Re: Closing Distributed Object connections
- Subject: Re: Closing Distributed Object connections
- From: Joji Mori <email@hidden>
- Date: Thu, 9 Oct 2003 13:10:10 +1000
Yeah, I am invalidating them. It is easy to replicate this example with
every Distributed Objects implementation.
Step 1. You set a root object on a server process (creating an
NSConnection on a particular hostname and port)
Step 2. Get client(s) to retain a proxy object to that server object
and use it as desired
Step 3. Invalidate the server connection (while the clients are still
connected, so this is an example of a server dying gracefully)
Step 4. Quit all those clients who were connect to the server
Step 5. Then attempt to set a root object again (creating an
NSConnection using the same hostname and port)
So in step 5, for the first few minutes the NSConnection you are trying
to create is returned nil. This could be what you are referring to when
you say there is a known bug in which ports cannot be reused
immediately after being closed. In this case it is true, but in the
example where the clients processes have quit completely before the
server quits, there is no delay in creating the new NSConnection on the
same port (ie switch steps 3 and 4 in the example above).
An aside - I find this a bit annoying, it would be nice if the client
would be notified if a connection was invalidated, rather than having
to wait for a timeout exception.
I take a quote from the documentation of NSConnection's
NSConnectionDidDieNotification
"An NSConnection object attached to a remote NSSocketPort object cannot
detect when the remote port becomes invalid, even if the remote port is
on the same machine. Therefore, it cannot post this notification when
the connection is lost. Instead, you must detect the timeout error when
the next message is sent."
Thanks again
Joji
>
> The problem lies with a server hosting an object, who closes it's
>
> NSConnection's fine, but there are still clients connected to the
>
> server. In this scenario the connection on the same host and port are
>
> rendered useless for the next few minutes.
>
>
I'm not sure how you're "closing NSConnection's"... presumably you are
>
invalidating them? Invalidating an NSConnection should cause it to
>
invalidate all it's port's immediately. Thus, there should be no
>
delay.
>
>
If you're doing this and there is a delay, you might be seeing what I
>
think is a known bug, in which ports cannot be reused immediately
>
after being closed. I have not seen this myself however, so it must
>
be implementation specific. You may be able to work around this by
>
adjusting the socket parameters... search the list archives for past
>
posts on the issue.
>
>
Wade Tregaskis
>
-- Sed quis custodiet ipsos custodes?
_______________________________________________
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.