- Joined
- Apr 24, 2010
- Messages
- 5
- Reaction score
- 0
- Points
- 1
- Location
- Ireland
- Your Mac's Specs
- Dual 1GHz G4 OSX10.4.11
Hello
I am relatively new to Cocoa but learning fast.
I have a specific problem which I hope may be answered by the
expertise on this forum.
I cannot seem to get a 'client' app to make a connection to a vended
object in a 'server' app. The relevant code in my 'server' app is:
- (void)awakeFromNib {
// create the comms port for receiving
port = [[[NSSocketPort alloc] initWithTCPPort:60000] retain];
NSLog(@"Socket Port = %@", [port address]);
// set up, retain and register connection
connection = [[[NSConnection alloc] initWithReceivePort: port sendPort: nil] retain];
[connection registerName: @"medix"];
[connection setRootObject:self];
NSLog(@"Connection = %@", connection);
}
This seems to work fine. The port is open and the NSLog confirms the
structure of the connection.
The problem lies in my 'client' code (I think):
- (void)awakeFromNib {
// set up and retain connection
connection = [[NSConnection connectionWithRegisteredName"medix" host"192.168.1.2"] retain];
NSLog(@"Connection Setup %@\n\n\n", connection);
remObject = [connection rootProxy];
NSLog(@"Connection Setup %@\n\n\n", remObject);
[remObject retain];
}
.. which refuses to connect and which does NOT display the remObject
structure in NSLog, but simply (null).
Am I doing something so obviously crazy that I can't see it ? ?
Thanks in advance
Chris
I am relatively new to Cocoa but learning fast.
I have a specific problem which I hope may be answered by the
expertise on this forum.
I cannot seem to get a 'client' app to make a connection to a vended
object in a 'server' app. The relevant code in my 'server' app is:
- (void)awakeFromNib {
// create the comms port for receiving
port = [[[NSSocketPort alloc] initWithTCPPort:60000] retain];
NSLog(@"Socket Port = %@", [port address]);
// set up, retain and register connection
connection = [[[NSConnection alloc] initWithReceivePort: port sendPort: nil] retain];
[connection registerName: @"medix"];
[connection setRootObject:self];
NSLog(@"Connection = %@", connection);
}
This seems to work fine. The port is open and the NSLog confirms the
structure of the connection.
The problem lies in my 'client' code (I think):
- (void)awakeFromNib {
// set up and retain connection
connection = [[NSConnection connectionWithRegisteredName"medix" host"192.168.1.2"] retain];
NSLog(@"Connection Setup %@\n\n\n", connection);
remObject = [connection rootProxy];
NSLog(@"Connection Setup %@\n\n\n", remObject);
[remObject retain];
}
.. which refuses to connect and which does NOT display the remObject
structure in NSLog, but simply (null).
Am I doing something so obviously crazy that I can't see it ? ?
Thanks in advance
Chris