Multiple DO Servers
Multiple DO Servers
- Subject: Multiple DO Servers
- From: "Ian G. Gillespie" <email@hidden>
- Date: Tue, 29 Mar 2005 16:15:35 -0500
Hi,
I have an app which currently uses DO (distributed objects) in a server-client fashion. I set this up because the app can work as a single-user version (where the server is embedded in the app) or as client and server stand-alone applications communicating over a LAN. However, I would like to use DO to allow another application to communicate with the client application using a different protocal. However, it seems that my application doesn't like to create two NSConnections for DO when running in single-user mode. This is the code my server uses to setup DO objects and it works fine.
if(_theConnection) {
[_theConnection registerName:nil];
} else {
_theConnection = [NSConnection defaultConnection];
}
[_theConnection setRootObject:self];
NSString *serverName = @"my_server_name";
[_theConnection registerName:serverName];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(connectionDidDie:)
name:NSConnectionDidDieNotification
object:_theConnection];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(connectionInitialized:)
name:NSConnectionDidInitializeNotification
object:_theConnection];
[_theConnection retain];
[_theConnection setDelegate:self];
When I try to create another NSConnection for my other server process, the connection is immediately terminated and my other client (in the other application I am working) can not connect to it.
When creating the NSConnection for my other server process, I probably don't want to use [NSConnection defaultConnection], but I am uncertain as to how to create a new connection using, [NSConnection connectionWithReceivePort:(NSPort *) sendPort:(NSPort *)]. Can anyone help me out with how to create appropriate ports or offer any other advice.
Thanks,
ian
_______________________________________________
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