File transfer from plugin problem

I have been working on establishing file transfers to and from an Openfire plugin. To do this I have the plugin create a contact that has a fileTransferListener. File transfers to a client from the plugin (plugin client) work just fine. Transfers from a client to the plugin (plugin client) terminate with the following error: The remote user did not respond or the connection timed out. I need help to understand why.

I am testing the connections on a single computer, however, this needs to also work in a server environment with remote connections.

I mapped out the packets going back and forth for this transaction.

Initial file transfer request sent by the server (plugin client):

<si xmlns="" id=“jsi_6494784254748412498” profile="">

<file xmlns="" name=“model.jar” size=“7486597”>

Requested file


Response from the client:



That is the end of the packets. The transfer times out with the aforementioned error. Again, any input here is appreciated and if I have not included useful information please let me know.

Thank you.


File transfers will only work if the destination user is online, so I wonder if perhaps Openfire thinks your dummy contact is offline and then won’t allow the request to go through? If that isn’t the problem, you may also get better support by asking this in the Openfire development forum because it seems like your case would be the same as a normal transfer as far as Smack is concerned.


Thank you for your response. It took me a while to respond because I went back over the code to examine the possible cause you presented. In fact, the two can see each other. To be sure, I had the sending client print out if it could not see the recipient at any point during the file transfer. I never got the print out and the transfer never got past Negotiating Transfer. The transfer terminates with the following error (as it has been) The remote user did not respond or the connection timed out. Exception was null.

To be clear, the recipient is getting the message requesting the file transfer from the sender. I am accepting and calling recieveFile(File). This message apparently is not getting back to the sender.

Thanks for the input and I appreciate any further ideas.

Ok. I figured it out. Not that it makes much sense why it works this way and not the other, however, I will describe the change and if anyone has a better explanation for this I would appreciate it.

The way the file transfer from the server to the client was setup, the client would send the initial message to the plugin. This would create a database entry and then tell the plugin established file transfer client to send the requested file to the requesting client. It would perform this all in one method call chain initiating from the packet listener. The result was the negotiating stream loop that would time out.

The change:

I hacked out the file transfer component and had the plugin return a confirmation receipt to the requesting client after creating the database entry. The requesting client would take the receipt message and then submit and available presence message to the server that would propagate in the file transfer client’s roster presence listener. This now goes and looks at the database to check for a transfer request and initiates the transfer if one exists. For some reason, this method works and the previous one does not.

I hope that this helps someone else out there. Even better, I hope someone can shed some light on why this change works.