我将smack升级到4.2.0版本后,出现了连接问题。
The following addresses failed: 'xxxx:5222' failed because:
de.measite.minidns.hla.ResolutionUnsuccessfulException: Asking for xxxx. IN A yielded an error response NX_DOMAIN, '52.90.233.38:5222' failed because: de.measite.minidns.hla.ResolutionUnsuccessfulException: Asking for xxxx. IN AAAA yielded an error response NX_DOMAIN
当连接配置构建器中设置主机时,会出现问题。
示例:
.setHost(ServiceConstants.CHAT_SERVER)
请查看https://github.com/igniterealtime/Smack/wiki/Smack-4.2-Readme-and-Upgrade-Guide了解更多相关的IT技术内容。
这是我的最终配置,在Davood Falahati的帮助下成功运行!
InetAddress inetAddress = InetAddress.getByName(ServiceConstants.CHAT_SERVER);
XMPPTCPConnectionConfiguration.Builder builder = XMPPTCPConnectionConfiguration.builder()
.setXmppDomain(JidCreate.from(ServiceConstants.CHAT_SERVER).asDomainBareJid())
.setPort(5222)
.setHostAddress(inetAddress)
.setDebuggerEnabled(true)
.setSendPresence(true)