#import "AqRendezvousController.h"
#import <sys/socket.h>
#import <netinet/in.h>
#import <unistd.h>
#import <arpa/inet.h>


@implementation AqRendezvousController

+ (id) instance; {
    static id instance = nil;
    if (!instance) instance = [[AqRendezvousController alloc] init];
    return instance;
}

- (double) portFromSocketPort: (NSSocketPort*) socketPort;
{ 
    NSData* addrData = [socketPort address];
    struct sockaddr_in addrIn = *(struct sockaddr_in *)[addrData bytes];
    NSLog(@"Port: %d", addrIn.sin_port);
    return addrIn.sin_port; 
}  

- (id) init;
{
    /*
    NSLog(@"AqRendezvousController: init");

    NSSocketPort* sPort = [[NSSocketPort alloc] init];
    
    service = [[NSNetService alloc] initWithDomain: @"" type: @"_acquisitionxbrowsehost._tcp." name: @"" port: [self portFromSocketPort: sPort]];
    [service setDelegate:self];
    [service publish];
    */
    
    return [super init];
}

- (void) applicationWillTerminate; {
/*
    [service stop];
    [browser stop];
*/
}

@end