Added -[TCPConnection initToBonjourService:] since MYBonjourService no longer vends an NSNetService.
1.1 --- a/TCP/TCPConnection.h Wed Apr 29 13:57:10 2009 -0700
1.2 +++ b/TCP/TCPConnection.h Wed Apr 29 21:05:01 2009 -0700
1.3 @@ -9,7 +9,7 @@
1.4 #import "TCPEndpoint.h"
1.5 #import <Security/Security.h>
1.6 @class IPAddress;
1.7 -@class TCPReader, TCPWriter, TCPListener;
1.8 +@class TCPReader, TCPWriter, TCPListener, MYBonjourService;
1.9 @protocol TCPConnectionDelegate;
1.10
1.11
1.12 @@ -47,6 +47,10 @@
1.13 If the service's address cannot be resolved, nil is returned. */
1.14 - (id) initToNetService: (NSNetService*)service;
1.15
1.16 +/** Initializes a TCPConnection to the given MYBonjourService's address and port.
1.17 + If the service's address cannot be resolved, nil is returned. */
1.18 +- (id) initToBonjourService: (MYBonjourService*)service;
1.19 +
1.20 /** Initializes a TCPConnection from an incoming TCP socket.
1.21 You don't usually need to call this; TCPListener does it automatically. */
1.22 - (id) initIncomingFromSocket: (CFSocketNativeHandle)socket listener: (TCPListener*)listener;
2.1 --- a/TCP/TCPConnection.m Wed Apr 29 13:57:10 2009 -0700
2.2 +++ b/TCP/TCPConnection.m Wed Apr 29 21:05:01 2009 -0700
2.3 @@ -8,6 +8,7 @@
2.4
2.5 #import "TCP_Internal.h"
2.6 #import "IPAddress.h"
2.7 +#import "MYBonjourService.h"
2.8
2.9 #import "Logging.h"
2.10 #import "Test.h"
2.11 @@ -103,6 +104,15 @@
2.12 return [self _initWithAddress: address inputStream: input outputStream: output];
2.13 }
2.14
2.15 +- (id) initToBonjourService: (MYBonjourService*)service;
2.16 +{
2.17 + NSNetService *netService = [[NSNetService alloc] initWithDomain: service.domain
2.18 + type: service.type name: service.name];
2.19 + self = [self initToNetService: netService];
2.20 + [service release];
2.21 + return self;
2.22 +}
2.23 +
2.24
2.25 - (id) initIncomingFromSocket: (CFSocketNativeHandle)socket
2.26 listener: (TCPListener*)listener