• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Help on Using Rendezvous in Panther
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help on Using Rendezvous in Panther


  • Subject: Re: Help on Using Rendezvous in Panther
  • From: Stefan Pantke <email@hidden>
  • Date: Wed, 3 Mar 2004 18:04:02 +0100

Maybe, you have to switch off your firewall. Although services get
advertised and found, the raw services may not be accessible if
ipfw prevents the specific port from passing.

Have a look at this. It works fine on 10.2.x and 10.3.x:

>>>
// This object is the delegate of its NSNetServiceBrowser object. We're only interested in services-related methods, so that's what we'll call.
- (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didFindService:(NSNetService *)aNetService moreComing:(BOOL)moreComing {

[services addObject:aNetService];
[aNetService setDelegate:self];
[aNetService resolve];

if(!moreComing) {
[self notifyDelegates];
}
}

- (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didRemoveService:(NSNetService *)aNetService moreComing:(BOOL)moreComing {

// This case is slightly more complicated. We need to find the object in the list and remove it.
NSEnumerator * enumerator = [services objectEnumerator];
NSNetService * currentNetService;
while(currentNetService = [enumerator nextObject]) {
if([[currentNetService name] isEqual:[aNetService name]]
&& [[currentNetService type] isEqual:[aNetService type]]
&& [[currentNetService domain] isEqual:[aNetService domain]]) {
[services removeObject:currentNetService];
break;
}
}

if(!moreComing) {
[self notifyDelegates];
}
}

Und:

- (void) registerAsRendezvousClient {
browser = [[NSNetServiceBrowser alloc] init];
services = [[NSMutableArray array] retain];
[browser setDelegate:self];
[browser searchForServicesOfType:@"_serviceName._tcp." inDomain:@"local."];
}


Und dies kvnnte auch noch hilfreich sein:

- (NSArray*) getServiceNames {
NSMutableArray *theNames = [NSMutableArray arrayWithCapacity:0];

int n;
for( n=0; n<[services count]; n++ ) {
[theNames addObject:[[services objectAtIndex:n] name]];
}

return theNames;
}

- (NSArray*) getAddressesForService: (NSString* ) aServiceName {
int n;
for( n=0; n<[services count]; n++ ) {
if ( YES == [aServiceName isEqualToString:[[services objectAtIndex:n] name]] ) {
// This is the service, we are searching for
return [[services objectAtIndex:n] addresses];
}
} // for

return nil;
} //getAddressForService:

- (NSData*) getFirstAddressForService: (NSString* ) aServiceName {
NSArray *theAddresses = [self getAddressesForService:aServiceName];


if ( 0 < [theAddresses count] ) {
return [theAddresses objectAtIndex:0];
} else {
return nil;
}

// NOT REACHABLE
} // getFirstAddressForService
<<<
Stefan
___
European developer? Join the EURO cocoa/WO developer listing!
Send an email to email@hidden for details.


Am 03.03.2004 um 11:25 schrieb Sunil:

Hi all,
I am a newbie to rendezvous of Panther.
I think I can use it to transfer a file ( specific to my app) to
another system.
I could compile the program with the NSNetService and
NSNetServiceBrowser.
I got a domain local. and I could get some services on _ftp._tcp., but
the addresses could not be resolved ( using resolve and addresses
methods of NSNetService,) nor the delegate of NSNetService
didNotResolve happened to be called.
How can I proceed?
-sunil
_______________________________________________
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.
_______________________________________________
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.


References: 
 >Help on Using Rendezvous in Panther (From: Sunil <email@hidden>)

  • Prev by Date: Re: Global vars vs IB
  • Next by Date: Re: subclassing NSArrayController
  • Previous by thread: Help on Using Rendezvous in Panther
  • Next by thread: subclassing NSArrayController
  • Index(es):
    • Date
    • Thread