title: XMPPFramework - TURNSocket can't receive the data that sent by myself?
body: <p>I used the openfire as the xmpp server, and want to transfer file via the Turnsocket.</p>
  
  <p>The openfire (local) config:</p>
  
  <pre><code>xmpp.auth.anonymous                true
  xmpp.domain                        local
  xmpp.enabled                       true
  xmpp.externalip                    proxy.local, 192.168.1.101, 127.0.0.1
  xmpp.proxy.enabled                 true
  xmpp.proxy.port                    7777
  xmpp.proxy.transfer.required       false
  xmpp.server.socket.active          true
  xmpp.session.conflict.limit        0
  xmpp.socket.ssl.active             true
  </code></pre>
  
  <p>I tested the file transfer in the local environment,  one user is logged in by Simulator (Sender), the other user is logged in by Device (iPod, receiver).</p>
  
  <ol>
  <li><p>TURNSocket.m (both changed), change the proxy</p>
  
  <pre><code>+ (void)initialize {
      ...
      proxyCandidates = [[NSMutableArray alloc] initWithObjects:@"local", nil];
      ...
  }
  </code></pre></li>
  <li><p>Config both on sender and receiver</p>
  
  <pre><code>- (BOOL)xmppStream:(XMPPStream *)sender didReceiveIQ:(XMPPIQ *)iq {
  
      ...
  
      if ([TURNSocket isNewStartTURNRequest:iq]) {
  
          NSLog(@"IS NEW TURN request Receive.. TURNSocket..................");
  
          TURNSocket *turnSocket = [[TURNSocket alloc] initWithStream:xmppStream incomingTURNRequest:iq];
          [turnSockets addObject:turnSocket];
          [turnSocket startWithDelegate:self delegateQueue:dispatch_get_main_queue()];
          [turnSocket release];
      }
      return YES;
  }
  </code></pre></li>
  <li><p>Setup and call TURNSocket (Sender)</p>
  
  <pre><code>TURNSocket *turnSocket = [[TURNSocket alloc] initWithStream:[self xmppStream] toJID:user.primaryResource.jid];
  [turnSockets addObject:turnSocket];
  [turnSocket startWithDelegate:self delegateQueue:dispatch_get_main_queue()];
  [turnSocket release];
  </code></pre></li>
  <li><p>didSucceed called both (sender and receiver)</p>
  
  <pre><code>- (void)turnSocket:(TURNSocket *)sender didSucceed:(GCDAsyncSocket *)socket {
  </code></pre>
  
  <p>}</p></li>
  <li><p>Send a file? on sender</p>
  
  <pre><code>- (void)turnSocket:(TURNSocket *)sender didSucceed:(GCDAsyncSocket *)socket {
  
      NSData *dataF = [[NSData alloc] initWithContentsOfFile:
                                     [[NSBundle mainBundle] pathForResource:@"a1" ofType:@"png"]];
  
      [socket writeData:dataF withTimeout:60.0f tag:0];
  }
  </code></pre>
  
  <p>OR: Received data here? (Receiver)</p>
  
  <pre><code>- (void)turnSocket:(TURNSocket *)sender didSucceed:(GCDAsyncSocket *)socket {
  
      NSData *dataF = [[NSData alloc] init];
  
      [socket readDataToData:dataF withTimeout:30.0 tag:0];
      NSLog(@"dataF: %d", [dataF length]); //  dataF: 0
  }
  </code></pre></li>
  </ol>
  
  <p>Does anyone know what's the problem?</p>
  
  <p>Thanks very much!</p>