1

Hi Am developing xmpp clint chat App. i would like to send file to friend but it is sending failed. am using the below code .. please help me any one

- (void)sendToOtherDevice:(NSData *)fileData receiverJid:(NSString *)receiverJid {

            XMPPJID *JID = [XMPPJID jidWithString:[NSString stringWithFormat:@"%@",receiverJid]];
            NSLog(@"%@",[JID full]);
            NSLog(@"fileData lenght == %d",fileData.length);
            NSLog(@"Attempting TURN connection to %@", JID);

            [TURNSocket setProxyCandidates:[NSArray arrayWithObjects:JID.domain, nil]];
            TURNSocket *turnSocket = [[TURNSocket alloc] initWithStream:[self xmppStream] toJID:JID];
            [turnSockets addObject:turnSocket];
            [turnSocket startWithDelegate:self delegateQueue:dispatch_get_main_queue()];
}

-(void)turnSocket:(TURNSocket *)sender didSucceed:(GCDAsyncSocket *)socket
        {
        //    [socket writeData:photoData withTimeout:60.0f tag:0];

            NSLog(@"TURN Connection succeeded!");
            NSLog(@"You now have a socket that you can use to send/receive data to/from the other person.");

            [turnSockets removeObject:sender];
}

-(void)turnSocketDidFail:(TURNSocket *)sender {

            NSLog(@"TURN Connection failed!");
            [turnSockets removeObject:sender];

}
iBhavin
  • 1,261
  • 15
  • 30
Nag Raj
  • 880
  • 1
  • 12
  • 18
  • possible duplicate of [FileTransfer using XmppFrameWork in ios](http://stackoverflow.com/questions/20114783/filetransfer-using-xmppframework-in-ios) – legoscia Jul 23 '14 at 09:41
  • @legoscia Am also implemented like above but getting "TURN Connection failed" every time.. i could not understand the problem – Nag Raj Jul 23 '14 at 11:00

0 Answers0