AnsweredAssumed Answered

IncomingFileTransfer and FileTransferRequest lifespan Smack 4.1.6

Question asked by Stefan hennemann on May 12, 2016
Latest reply on May 14, 2016 by Stefan hennemann

Hi there,


this is a general question using Smack 4.1.6, I faced a problem with IncomingFileTransfer if I send a file and the receiver does not accept the request in a certain time. For example, you have a chat app, the receiver receives the message that some file is send to him, but does not accept the request directly. He accept it one hour later, but then, the IncomingFileTransfer to catch the file is aborting and throws NoResponseException. If the receiver instead accepts it directly or after some minutes, everything works fine.


I assume that in the NoResponseException case, the file isn´t available anymore. I was able to store the FileTransferRequest as an object and get it if I want to. This request is still valid after some hours, I can get all the information from that like sender jid, filename etc. So that is not the problem, the problem starts here:


InputStream is = incomingFileTransfer.receiveFile();


After this long time, the InputStream is null. But after only some minutes, it works. I think that there is something happen on the server site, file gets deleted after a while or something in that way.


Has anybody some experience/knowledge about how long the IncomingFileTransfer is able to get the InputStream via receiveFile() ?


I saw this example of FileTransfer:


smack-examples/ at master · Flowdalic/smack-examples · GitHub


What is the reason for building two different connections for incoming and outgoing filetransfer? Has this something to do with the problem I faced?