+- (void)netServiceBrowser:(NSNetServiceBrowser *)browser didFindService:(NSNetService *)aService moreComing:(BOOL)more
+{
+ // a server has broadcast; not much use until it's resolved.
+ [aService setDelegate:self];
+ [aService resolve];
+}
+
+- (void)netServiceDidResolveAddress:(NSNetService *)aService
+{
+ int i, top = [serverList count];
+
+ // ignore if this is the local server.
+ if ( TCGlobalAllowRemote && [[aService name] isEqualToString:TCGlobalBroadcastName] )
+ {
+ return;
+ }
+
+ // ignore if the server name is already in the list.
+ for ( i = 0; i < top; i++ )
+ {
+ if ( [[aService name] isEqualToString:[(NSNetService *)[serverList objectAtIndex:i] name]] )
+ {
+ return;
+ }
+ }
+
+ [serverList addObject:aService];
+ NSLog( @"server added: %i", [serverList count] );
+
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"TCServerFound" object:aService];
+}
+
+- (void)netServiceBrowser:(NSNetServiceBrowser *)browser didRemoveService:(NSNetService *)aService moreComing:(BOOL)more