More socket work
[ITFoundation.git] / ITServiceBrowserDelegate.m
1 //
2 //  ITServiceBrowserDelegate.m
3 //  ITFoundation
4 //
5 //  Created by Alexander Strange on Sat Mar 15 2003.
6 //  Copyright (c) 2003 __MyCompanyName__. All rights reserved.
7 //
8
9 #import "ITServiceBrowserDelegate.h"
10 #import "ITInetSocket.h"
11 #import <Foundation/NSNetServices.h>
12
13 @implementation ITServiceBrowserDelegate
14 - (id) initWithDelegate:(id)_delegate
15 {
16     if (self = [super init])
17            {
18            delegate = _delegate;
19            }
20     return self;
21 }
22
23 - (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didFindService:(NSNetService *)aNetService moreComing:(BOOL)moreComing
24 {
25     ITInetSocket *sock;
26     if (!moreComing)
27            {
28            [aNetServiceBrowser stop];
29            [aNetServiceBrowser release];
30            }
31     sock = [[ITInetSocket alloc] initWithDelegate:delegate];
32     [sock connectWithSockaddrArray:[aNetService addresses]];
33 }
34
35 @end