Re: Problems with NSSocketPort
Re: Problems with NSSocketPort
- Subject: Re: Problems with NSSocketPort
- From: Ben Lachman <email@hidden>
- Date: Tue, 11 Feb 2003 00:00:00 -0500
Nick Zitzmann kindly reminded me that I had qouted the wrong version of
my code. It should have been:
- (void)startOnPort:(short int)portNum {
NSSocketPort *port = [[NSSocketPort alloc] initWithTCPPort:portNum];
NSConnection *conn = [[NSConnection alloc] initWithReceivePort:port
sendPort:nil];
...
The problem is that port is never non-NULL, which makes conn be NULL as
well.
Any ideas?
->Ben
On Monday, February 10, 2003, at 10:19 PM, Ben Lachman wrote:
Hi,
I dug out some old distributed object code that I know used to work,
but it doing weird stuff now. I can't seem to get a valid
NSConnection no matter what I do. I'm including the code, any help
would be appreciated.
- (void)startOnPort:(short int)portNum {
NSSocketPort *port = [NSSocketPort alloc];
NSConnection *conn = [NSConnection alloc];
[port initWithTCPPort:portNum];
if(port) {
[conn initWithReceivePort:port sendPort:nil];
} else {
NSLog(@"Null port object!");
}
[conn setDelegate:self];
[conn setRootObject:self];
[[NSRunLoop currentRunLoop] run];
[conn release];
[port release];
}
--
\|||/
(o o)
|~~~~ooO~~(_)~~~~~~~|
| Please |
| don't feed the |
| TROLLS |
'~~~~~~~~~~~~~~Ooo~~'
|__|__|
|| ||
ooO Ooo
_______________________________________________
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.