Smack 4.1.6 connection time

Hi all,

I am a newbie to Smack & Openfire server and having a question about connecting & login to openfire sever using Smack API

I’m running the following code and those simple lines take 350 milisec. to execute , my question is : there is anyway to reduce this time and is that even normal?

XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()

.setUsernameAndPassword(username, password)

.setHost(server)

.setServiceName(server)

.setPort(port)

.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled)

.build();

connection = new XMPPTCPConnection(config);
connection.connect();

connection.login();

connect() and login() are taking some time. This is normal and actually quite quick. These methods block and communicate with the server (establish TCP connection, negotiate streams, do authentication).

even if the sever and the client are connecting on the same local network ?

Likely yes. I don’t think 350ms is that much. There’s a lot going on under the hood (creating socket, connecting, open stream, receiving stream, negotiate stream features, parsing XML, writing XML, crypto functions and challenge-response for authentication)

Thank you CSH

Smack’s debugger allows you to precisely analyze how much time is spent in which step.