powered by Jive Software

Reconnection error: bindResourceAndEstablishSession

Hi all,

I make an application with 3.2.1 Smack library using jabber.org accounts and i have always (or almost the time) the same problem with reconnection.

No response from the server.:

      at org.jivesoftware.smack.SASLAuthentication.bindResourceAndEstablishSession(SASLA uthentication.java:452)

      at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java: 348)

      at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:203)

      at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:964)

      at org.jivesoftware.smack.ReconnectionManager$2.run(ReconnectionManager.java:128)

This error occurr with a simplistic test like unplug and plug the network cable.

I read a lot about it and i check the source file of SASLAuthentication and i can’t found the solution for this problem.

I try to resolve it with some solutions like using google accounts or add more time to the reply time

SmackConfiguration.setPacketReplyTimeout(30000);

because in the SASLAuthentication source file we have this lines

private String bindResourceAndEstablishSession(String resource) throws XMPPException {

// Wait up to a certain number of seconds for a response from the server.

Bind response = (Bind) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());

collector.cancel();

if (response == null) {

      throw new XMPPException("No response from the server.");

}

but without success.

This is a big problem of Smack that make me think to change the XMPP library.

Please help me.

Regards,

Paulo Marques

PS: one more thing, i want to make a reconnection mecanism like google talk, when a error occurrs we have a “try now” that stop the time to make to reconnect, and if it fail, the time grow up. Anybody know to do that? it’s possible get the ReconnectionManager instance of the connection?

Help please!

I did not use Smack long ago. Anyhow 3.2.2 is the current version which you may want to use.

You could also try a nightly build.

I have faced the same problem

code is like:

con.connect()

con.login(username,pass)

but login failed because of no response from the server

the exception is from bindResourceAndEstablishSession

in this condition if you try to reconnect

you should use code:

con.disconnect()

to disable the pre con , so the server knows this con will log out

otherwise if you use

con.connect()

con.login() without con.disconnect() function

you will get an exception like this:

conflict(409)

at org.jivesoftware.smack.SASLAuthentication.bindResourceAndEstablishSession(SASLA uthentication.java:456)

at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java: 348)

at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:203)

good luck