Reputation: 2105
I have two questions :
I have a jabber client developed with Xcode in Objective-C, and I have an Openfire server installed.
When I run the server, two clients will connect. First - my jabber client: a spark IM client and the second - my iPhone app. There's no problem with communication. My only problem lies when making image transfers.
Here is the code:
- (void)viewDidLoad
{
[super viewDidLoad];
self.tView.delegate = self;
self.tView.dataSource = self;
[self.tView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
messages = [[NSMutableArray alloc ] init];
JabberClientAppDelegate *del = [self appDelegate];
del._messageDelegate = self;
[self.messageField becomeFirstResponder];
XMPPJID *jid = [XMPPJID jidWithString:chatWithUser];
NSLog(@"Attempting TURN connection to %@", jid);
TURNSocket *turnSocket = [[TURNSocket alloc] initWithStream:[self xmppStream] toJID:jid];
[turnSockets addObject:turnSocket];
[turnSocket startWithDelegate:self delegateQueue:dispatch_get_main_queue()];
[turnSocket release];
}
- (void)turnSocket:(TURNSocket *)sender didSucceed:(GCDAsyncSocket *)socket
{
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];
}
I don't know if is because both are using the same IP and trying to connect to the server with the same IP or is there something on the Openfire server that is disabled.
Now the second question...
To resolve the first problem, I have installed the Openfire server on another computer. In the spark client on advanced setup, I'll pass the IP (the IP is a nat address, 192.168... ) and port and the name of server.
But in my iPhone application, it doesn't connect. How can I make the connection? In localhost, it runs perfectly. I've tried to change the name of host, etc. but to no avail.
Can somebody help me with this?
P.S. What do I have to do to in OpenFire Server to allow data transfer?
Upvotes: 1
Views: 1971
Reputation: 158
It looks like you are using XMPPFramework in the client.
TURNSocket is a misnomer. The class actually implements XEP-0065. You need to setup a SOCKS5 proxy server. I'm not sure if OpenFire supports SOCKS. OpenFire is used for in-band signalling that helps the two clients decide how to transfer the file. But a SOCKS5 server is required to transfer the actual file in an out-of-band stream.
Upvotes: 1