I have created a chat application using the Jabber Smack API. I’m successfully receiving files (from another app named “Gajim” ) but my upload fails in a few seconds only. After the “Negotiating” transfer status, I get an “error” status.
I corrected this error by supplying a “fully qualified” jabber ID but now the transfer gets indefinitely stuck at “negotiating stream” after I accept the transfer from another (Gajim) client.
I have the following code for my swingWorker class :
OutgoingFileTransfer transfer;
@Override
public Void doInBackground() {
transfer = manager.createOutgoingFileTransfer("vedant1811@jabber.org/Gajim");
File uploadFile = fileChooser.getSelectedFile();
try {
transfer.sendFile(uploadFile, "test");
} catch (XMPPException ex) {
System.out.println("sendFile Error");
ex.printStackTrace();
}
while (!transfer.isDone()) {
if (transfer.getStatus().equals(Status.error)) {
transferLabel.setText("ERROR!!! " + transfer.getError());
} else {
transferLabel.setText("Uploading File: " + uploadFile.getName()
+ " STATUS: " + transfer.getStatus());
fileProgressBar.setValue((int) (100 * transfer.getProgress()));
}
try {
Thread.sleep(500);
} catch (InterruptedException ex) {
System.out.println("thread.sleep error");
ex.printStackTrace();
}
}
return null;
}
Error was in the jabber server.
Using the openfire server solved all my problems