Symmetric Distributed Objects
Symmetric Distributed Objects
- Subject: Symmetric Distributed Objects
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Tue, 18 Jul 2006 11:20:05 +0200
I have two computers, both run identical copies of MyApp.
MyApp does at start:
p = [ NSSocketPort initWithTCPPort: 56789 ]
c = [NSConnection initWithReceivePort: p sendPort: nil ]
[ c setRootObject: self ]
[ NSNetService initWithDomain: @"" type: @"_MyApp._tcp." name:
hostname port: 56789] - publish.
[ NSNetServiceBrowser searchForServicesOfType: @"_MyApp._tcp."
inDomain: @"" ]
The NSNetServiceBrowser will find itself and MyApp on the other
computer.
Occasionally MyApp does:
[ NSNetService initWithDomain: @"local." type: @"_MyApp._tcp."
name: peerName ]; [ ns resolveWithTimeout: 2.7 ].
It gets an address, creates an NSPort, NSConnection.
Finally does proxy = [ connectionToPeer rootProxy ] and starts
talking to the peer.
This works ok 99% of the time.
But sometimes [ connectionToPeer rootProxy ] takes 75 seconds and
then returns nil.
Question: is this scenario - both copies of MyApp acting as server
and occasionally as client; both using the same port - ok?
Or is it principally wrong and only works by some happy chance?
Gerriet.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden