IncomingFileTransfer never isDone()

I am implementing File Transfer and have an issue where an IncomingFileTransfer never returns a true isDone(). The sender OutgoingFileTransfer correctly gets a true result from isDone() and the file is successfully transferred. The getStatus() on the receiver continually returns IN_PROGRESS.

transfer.recieveFile(file);

while (!transfer.isDone()) {

try {

Thread.sleep(500);

if (transfer.getStatus() == FileTransfer.Status.COMPLETE) {

System.out.println(“Transfer COMPLETE”);

}

else if (transfer.getStatus() == FileTransfer.Status.IN_PROGRESS) {

System.out.println(“Transfer IN PROGRESS”);

}

else if (transfer.getStatus() == FileTransfer.Status.ERROR) {

System.out.println(“Transfer ERROR”);

}

} catch (InterruptedException e) {

}

}

Thoughts?

Thanks,

Pony

I am looking into this issue, in the mean time could you post any output you have in the smack debugger.

Thanks,

Alex

It appears to be a threading issue. In my code or Smack is the question. The file is coming across but I don’‘t get the output in the debugger or a positive result from isDone(). If I don’'t do the monitoring loop, the debug shows the messages carrying the data and the closing IQ from the sender - plus the IQ sent to signify completion.

Here is what the debugger shows:

RECV:


SENT:


SENT:

It appears that I have to thread the monitoring loop. It is holding up the PacketReader.

Here is the call hierarchy:

PacketReader$2.run

PacketReader.access$1

PacketReader.processListeners

PacketReader$ListenerWrapper.notifyListener

FileTransferManager$1.processPacket

FileTransferManager.fireNewRequest

FileTransferService.fileTransferRequest - my code

My code then does

IncomingFileTransfer transfer = request.accept();

File file = new File(“filenamehere”);

try {

transfer.recieveFile(file);

//looping is effectively here

} {catch XMPPException e) {

//exception handling

}

BTW, recieveFile is misspelled.

Pony

I should have noticed that when you first posted. I’'ll look into making the fact more clear in the docs.

Cheers,

Alex