Reputation: 581
I'm using Openfire server (3.7.1) for XMPP authentication, messaging and file transfer. I'm using iOS's XMPPFramework to communicate with it.
I've successfully established authentication, sending and receiving presence, sending and receiving messages. However when I tried to use file transfer, I wasn't able to accomplish.
Please take a look at my code below.
For the sender:
NSArray *proxyList = [NSArray arrayWithObjects:self.hostname,nil];
[TURNSocket setProxyCandidates:proxyList];
TURNSocket *fileTransferSocket = [[TURNSocket alloc] initWithStream:self.xmppStream toJID:userJid];
if (fileTransferSocket) {
[fileTransferSocket startWithDelegate:self delegateQueue:dispatch_get_main_queue()];
}
For the receiver:
- (BOOL)xmppStream:(XMPPStream*)sender didReceiveIQ:(XMPPIQ *)iq {
if ([TURNSocket isNewStartTURNRequest:iq]) {
TURNSocket *receiverSock = [[TURNSocket alloc] initWithStream:self.xmppStream incomingTURNRequest:iq];
[self.turnSockets addObject:receiverSock];
[receiverSock startWithDelegate:self delegateQueue:dispatch_get_main_queue()];
}
return YES;
}
Also implemented the delegate methods of TURNSocket:
- (void)turnSocket:(TURNSocket *)sender didSucceed:(GCDAsyncSocket *)socket {
NSLog(@"Socket Suceeed Port For File Transfer: %d",socket.localPort);
if ([self.turnSockets containsObject:sender]) {
NSLog(@"File Transfer Ulastiiiiiiii");
NSUInteger indexOfObj = [self.turnSockets indexOfObject:sender];
[self.turnSockets removeObjectAtIndex:indexOfObj];
}
}
But when I try to start file transferring process, I receive an error like this:
<query xmlns="http://jabber.org/protocol/bytestreams" sid="99DC0DA7-55ED-4A53-9A8F-F65F1706E1B2" mode="tcp">
<streamhost jid="proxy.192.168.12.30" host="192.168.12.30" port="7777"/>
</query>
<error code="503" type="cancel"><service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
</iq>
I don't understand what the problem might be.
The only thing that came to my mind is that I'm not using SSL authentication while connecting to server. Could it be the reason or is it something else I'm missing?
Thanks.
Upvotes: 4
Views: 4077
Reputation: 35
in XMPP - presence delegate
use : [self from] full], will full JID with resource.
1) [self from]user], gives only Username@domain 2) [self from] full], gives full JID as below
JID : username@domain/resourceid
hope, above information will help
Upvotes: 1