{
if (self = [super init])
{
- delegate = _delegate;
+ delegate = [_delegate retain];
}
return self;
}
+- (void) dealloc
+{
+ [delegate release];
+}
+
- (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didFindService:(NSNetService *)aNetService moreComing:(BOOL)moreComing
{
ITInetSocket *sock;
+ NSArray *arr;
+ id d = delegate;
if (!moreComing)
{
+ NSLog(@"Nothing more coming");
+ [[aNetService retain] autorelease];
[aNetServiceBrowser stop];
[aNetServiceBrowser release];
+ [self release];
}
- sock = [[ITInetSocket alloc] initWithDelegate:delegate];
- [sock connectWithSockaddrArray:[aNetService addresses]];
+ sock = [[ITInetSocket alloc] initWithDelegate:d];
+ NSLog(@"Detected a service! name %@ type %@",[aNetService name],[aNetService type]);
+ arr = [aNetService addresses];
+ if ([arr count])
+ [sock connectWithSockaddrArray:arr];
+ else
+ NSLog(@"There are no sockaddrs for this service!");
}
@end