Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 4th, 2013  |  syntax: None  |  size: 0.63 KB  |  views: 25  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. - (BOOL) setupConnection: (DNSSDService*) service
  2. {
  3.     NSString *host = [service resolvedHost];
  4.     NSUInteger port = [service resolvedPort];
  5.     NSLog(@"in setupConnection: host %@ port %u",
  6.           host, port);
  7.  
  8.     self.sock = [[GCDAsyncUdpSocket alloc]initWithDelegate:self
  9.                 delegateQueue:dispatch_get_main_queue() ];
  10.     NSError *err = nil;
  11.     if (![self.sock connectToHost:host onPort:port error:&err]) {
  12.         NSLog(@"we goofed: %@", err);
  13.         return NO;
  14.     }
  15.     return YES;
  16. }
  17.        
  18. Error Domain=GCDAsyncUdpSocketErrorDomain Code=4 "Socket closed" UserInfo=0x2630c0 {NSLocalizedDescription=Socket closed}
clone this paste RAW Paste Data