Client sessions are disconnected

Hi Support,

Versions: Openfire 3.7.1, Smack3.2.1 and connection manager is running on port number 5333.

Once the authentication is completed client sessions are terminated immediately and they are not at all listening for file transfer.
As of now I have observed in the following two scenarios only client sessions are listening for file transfer

a) When I add this line
XMPPConnection.DEBUG_ENABLED = true;

b) When I use Thread.sleep(…)
try {
Thread.sleep(3200);
} catch (InterruptedException e) {
e.printStackTrace();
}

XMPPConnection.DEBUG_ENABLED = true I can use this line when I am running in windows env. But my Linux box doesn’t support GUI and that’s why I commented this line and for time being I am using thread.sleep(…)

Please let me know why client sessions are disconnected by using this program.

Receiver program:

import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.SASLAuthentication;
import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smackx.filetransfer.FileTransferListener;
import org.jivesoftware.smackx.filetransfer.FileTransferManager;
import org.jivesoftware.smackx.filetransfer.FileTransferRequest;
import org.jivesoftware.smackx.filetransfer.IncomingFileTransfer;

public class OpenfireReceiverThread implements Runnable {

private String user = null;

public OpenfireReceiverThread(int resCount) {
this.user = “receiver” + resCount;
}

public void login() {
SmackConfiguration.setPacketReplyTimeout(45000);
ConnectionConfiguration config = new ConnectionConfiguration(“myipaddress”, 5333, “myservicename”);
final XMPPConnection connection = new XMPPConnection(config);

try {
connection.connect();
SASLAuthentication.supportSASLMechanism(“PLAIN”, 0);
connection.login(user, user);
System.out.println("Logged in as " + connection.getUser());
Presence presence = new Presence(Presence.Type.available);
connection.sendPacket(presence);

} catch (XMPPException ex) {
ex.printStackTrace();
System.out.println("Failed to log in as " + connection.getUser());
System.exit(1);
}

final FileTransferManager manager = new FileTransferManager(connection);
manager.addFileTransferListener(new FileTransferListener() {
public void fileTransferRequest(FileTransferRequest request) {
try {
IncomingFileTransfer transfer = request.accept();
transfer.recieveFile(new File(transfer.getFileName()));
System.out.println("File Received: " + connection.getUser()
+ " " + request.getFileName());
} catch (XMPPException e) {
e.printStackTrace();
}
}
});

try {
Thread.sleep(320);
} catch (InterruptedException e) {
e.printStackTrace();
}
}

public static void main(String args[]) {
int startLimit = 0;
int receiversLimit = 0;
int num = args.length;
if (num > 0 && num == 2) {
try {
startLimit = Integer.parseInt(args[0]);
receiversLimit = Integer.parseInt(args[1]);
} catch (NumberFormatException ex) {
System.out.println(“Enter a valid number.”);
System.exit(1);
}
for (int i = startLimit; i < receiversLimit; i++) {
try {
Thread.sleep(50);
} catch (Exception e) {
System.out.println(e.getMessage());
}
Runnable task = new OpenfireReceiverThread(i);
Thread thread = new Thread(task);
thread.start();
}

} else {
System.out.println(“Enter the start and end Limit”);
}
}
public void run() {
login();
}
}

Running the program as below :

#java OpenfireReceiverThread 0 80

Thanks