powered by Jive Software

Smack connection issue

Smack version: 4.4.6

When I try connection with XMPP server I got this isue:

 - java.lang.Exception: java.lang.AssertionError

My code:

        withContext(Dispatchers.Default) {
            try {
                val config = XMPPTCPConnectionConfiguration.builder()
                    .setUsernameAndPassword("userName", "Password")

                XMPPConnection = XMPPTCPConnection(config)

            } catch (error: Throwable) {

The connection is success after set host as IP


why we need set host as IP?

Smack (like all other XMPP clients) will try to perform to resolve the IP address of the server to connect to through DNS records (DNS SRV and DNS A records). If no such records are available, or if the information in them cannot be used to find out where the server to connect to is, then you will need to manually provide that address. I think that this might be what you are running into.

1 Like

Thanks for reply
I tried to connect by another XMPP client without set the IP address and the connect success
why isn’t success in smack without setting the IP address?

The answer to this is very specific to your network configuration as well as the implementation of the other client. I cannot answer that, without knowing all of the details.

You hit the assertion that either there are some discovered remote connection endpoints or there are some lookup failures. However both data structures are empty. If you want to get down to the bottom of this, which I would very much appreciate, since I am unable to reproduce this, then attach an debugger and set a breakpoint at RemoteXmppTcpConnectionEndpoints.java:62 to figure out what is going on.

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.