【问题标题】:My iOS app worked well under IPv6, but it was wrong to connect to XMPP. The Android didn't has the error我的 iOS 应用程序在 IPv6 下运行良好,但连接到 XMPP 是错误的。 Android没有错误
【发布时间】:2017-06-30 09:11:31
【问题描述】:

图片正在测试服务器的域名。我通过5222端口连接XMPP,失败原因:

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

【问题讨论】:

    标签: ios xmpp ipv6 xmppframework


    【解决方案1】:

    XMPPStream.m 文件中,转到init 函数,就在行的下方

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

    添加以下行

    [asyncSocket setPreferIPv4OverIPv6:NO];
    

    然后聊天将在 IPV4 和 IPV6 中工作

    【讨论】:

      猜你喜欢
      • 2015-07-12
      • 1970-01-01
      • 1970-01-01
      • 2011-05-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-16
      相关资源
      最近更新 更多