# HG changeset patch # User Jens Alfke # Date 1241064301 25200 # Node ID a9c59b0acbbcb28e9397e8a5dc48a58688b66500 # Parent b3254a2f6d6c3bd525b1ab484706819334034e24 Added -[TCPConnection initToBonjourService:] since MYBonjourService no longer vends an NSNetService. diff -r b3254a2f6d6c -r a9c59b0acbbc TCP/TCPConnection.h --- a/TCP/TCPConnection.h Wed Apr 29 13:57:10 2009 -0700 +++ b/TCP/TCPConnection.h Wed Apr 29 21:05:01 2009 -0700 @@ -9,7 +9,7 @@ #import "TCPEndpoint.h" #import @class IPAddress; -@class TCPReader, TCPWriter, TCPListener; +@class TCPReader, TCPWriter, TCPListener, MYBonjourService; @protocol TCPConnectionDelegate; @@ -47,6 +47,10 @@ If the service's address cannot be resolved, nil is returned. */ - (id) initToNetService: (NSNetService*)service; +/** Initializes a TCPConnection to the given MYBonjourService's address and port. + If the service's address cannot be resolved, nil is returned. */ +- (id) initToBonjourService: (MYBonjourService*)service; + /** Initializes a TCPConnection from an incoming TCP socket. You don't usually need to call this; TCPListener does it automatically. */ - (id) initIncomingFromSocket: (CFSocketNativeHandle)socket listener: (TCPListener*)listener; diff -r b3254a2f6d6c -r a9c59b0acbbc TCP/TCPConnection.m --- a/TCP/TCPConnection.m Wed Apr 29 13:57:10 2009 -0700 +++ b/TCP/TCPConnection.m Wed Apr 29 21:05:01 2009 -0700 @@ -8,6 +8,7 @@ #import "TCP_Internal.h" #import "IPAddress.h" +#import "MYBonjourService.h" #import "Logging.h" #import "Test.h" @@ -103,6 +104,15 @@ return [self _initWithAddress: address inputStream: input outputStream: output]; } +- (id) initToBonjourService: (MYBonjourService*)service; +{ + NSNetService *netService = [[NSNetService alloc] initWithDomain: service.domain + type: service.type name: service.name]; + self = [self initToNetService: netService]; + [service release]; + return self; +} + - (id) initIncomingFromSocket: (CFSocketNativeHandle)socket listener: (TCPListener*)listener