Lim
Lim

Reputation: 322

My iOS app worked well under IPv6, but it was wrong to connect to XMPP. The Android didn't has the error

The picture is testing the domain name of the server. I connect XMPP via port 5222, failed for the reason:

Error Domain=NSPOSIXErrorDomain 
Code=51 "Network is unreachable" 
UserInfo={
    NSLocalizedDescription=Network is unreachable,
    NSLocalizedFailureReason=Error in connect() function}

enter image description here

Upvotes: 1

Views: 258

Answers (1)

Amal T S
Amal T S

Reputation: 3405

In the XMPPStream.m file, go to init function, just below the line

asyncSocket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:xmppQueue];

add the following line

[asyncSocket setPreferIPv4OverIPv6:NO];

chat will work in both IPV4 & IPV6 then

Upvotes: 3

Related Questions