title: Establish connection to Sony DSC QX10 (Sony Camera Remote API) using AsyncUdpSocket for SSDP connection on iPhone
body: <p>Yesterday I started to develop an iPhone app using the Sony Camera Remote API.</p>
  
  <p>The initial step to use the WiFi camera is to establish a connection to the camera. Therefore I used the AsyncUdpSocket to start the ssdp discover using this code:</p>
  
  <pre><code>-(void)discoverWiFiCamera{
  self.ssdpSock = [[AsyncUdpSocket alloc] initIPv4];
  [self.ssdpSock setDelegate:self];
  [self.ssdpSock enableBroadcast:TRUE error:nil];
  
  NSError *socketError = nil;
  if (![self.ssdpSock bindToPort:1900 error:&amp;socketError]) {
      NSLog(@"Failed binding socket: %@", [socketError localizedDescription]);
  }
  if(![self.ssdpSock joinMulticastGroup:@"239.255.255.250" error:&amp;socketError]){
      NSLog(@"Failed joining multicast group: %@", [socketError localizedDescription]);
  }
  if (![self.ssdpSock enableBroadcast:TRUE error:&amp;socketError]){
      NSLog(@"Failed enabling broadcast: %@", [socketError localizedDescription]);
  }
  
  [self.ssdpSock sendData:[@"M-SEARCH * HTTP/1.1\r\nHOST: 239.255.255.250:1900\r\nMAN: \"ssdp:discover\"\r\nMX: 1\r\nST: urn:schemas-sony-com:service:ScalarWebAPI:1\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]
                   toHost:@"239.255.255.250" port:1900 withTimeout:-1 tag:1];
  [self.ssdpSock receiveWithTimeout:-1 tag:1];
  [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(completeSearch:) userInfo:self repeats:NO];
  }
  
  - (BOOL)onUdpSocket:(AsyncUdpSocket *)sock didReceiveData:(NSData *)data withTag:(long)tag fromHost:(NSString *)host port:(UInt16)port{
  NSLog(@"%s %ld %@ %d",__FUNCTION__,tag,host,port);
  NSString *aStr = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
  NSLog(@"\r\n%@",aStr);
  
  return YES;
  }
  </code></pre>
  
  <p>As it appears, the app is able to establish a connection to the camera (Sony DSC QX10). Therefore, a response from the host (IP address: 10.29.57.38) is received by the iPhone (IP address: 10.0.1.1). However, the response data is exactly the same as the sent data. </p>
  
  <pre><code>M-SEARCH * HTTP/1.1
  HOST: 239.255.255.250:1900
  MAN: "ssdp:discover"
  MX: 1
  ST: urn:schemas-sony-com:service:ScalarWebAPI:1
  </code></pre>
  
  <p>Therefore, I'd like to ask, if anybody of you already experiences the same behavior of the Sony Camera API or the AsnycUdpSocket?</p>
  
  <p>Thanks,
  Josef</p>