Hello,
I’ve been struggeling with the following problem for a long time, but couldn’t solve it at all. Im trying a file transfer via xmpp using smack for Android with the following code:
fTManager = FileTransferManager.getInstanceFor(connection);
fTManager.addFileTransferListener(new FileTransferListener() {
@Override
public void fileTransferRequest(FileTransferRequest fileTransferRequest) {
String requerstor = fileTransferRequest.getRequestor();
try {
IncomingFileTransfer transfer = fileTransferRequest.accept();
transfer.recieveFile(new File(getExternalFilesDir(null), transfer.getFileName())); bufferedReader = new BufferedReader(new FileReader(new File(getExternalFilesDir(null), transfer.getFileName())));
String line;
while ((line = bufferedReader.readLine()) != null)
Log.i("Line", "LINE " + line);
while (!transfer.isDone()) {
Thread newThread = new Thread();
Log.i("FileTransferManager", "File transfer is " + String.format("%1$,.2f", transfer.getProgress() * 100) + "% complete.");
try {
newThread.sleep(1000);
} catch (InterruptedException e) {e.printStackTrace();}
} if (transfer.isDone())
Log.i("FileTransferManager", "Transfer status is:" + transfer.getStatus());
if (transfer.getError() != null)
Log.i("FileTransferManager", "Transfer error occurred:" + transfer.getError().getMessage());
if(transfer.getException() != null)
transfer.getException().printStackTrace();
}
catch (SmackException e) {e.printStackTrace();}
catch (IOException e) { e.printStackTrace();}
As
transfer.recieveFile(new File(getExternalFilesDir(null), transfer.getFileName()));
is reached I am getting the following error:
03-23 12:47:37.890 888-916/? W/System.err﹕ org.jivesoftware.smack.SmackException: Error in execution
03-23 12:47:37.890 888-916/? W/System.err﹕ at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer.negotiateStream(IncomingFileTransfer.java:199)
03-23 12:47:37.900 888-916/? W/System.err﹕ at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer.access$100(IncomingFileTransfer.java:57)
03-23 12:47:37.900 888-916/? W/System.err﹕ at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer$1.run(IncomingFileTransfer.java:129)
03-23 12:47:37.900 888-916/? W/System.err﹕ at java.lang.Thread.run(Thread.java:841)
03-23 12:47:37.900 888-916/? W/System.err﹕ Caused by: java.util.concurrent.ExecutionException: org.jivesoftware.smack.SmackException: SOCKS5 negotiation failed
03-23 12:47:37.920 888-916/? W/System.err﹕ at java.util.concurrent.FutureTask.report(FutureTask.java:93)
03-23 12:47:37.920 888-916/? W/System.err﹕ at java.util.concurrent.FutureTask.get(FutureTask.java:177)
03-23 12:47:37.920 888-916/? W/System.err﹕ at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer.negotiateStream(IncomingFileTransfer.java:193)
03-23 12:47:37.930 888-916/? W/System.err﹕ ... 3 more
03-23 12:47:37.930 888-916/? W/System.err﹕ Caused by: org.jivesoftware.smack.SmackException: SOCKS5 negotiation failed
03-23 12:47:37.930 888-916/? W/System.err﹕ at org.jivesoftware.smackx.bytestreams.socks5.Socks5Client$1.call(Socks5Client.java:105)
03-23 12:47:37.930 888-916/? W/System.err﹕ at org.jivesoftware.smackx.bytestreams.socks5.Socks5Client$1.call(Socks5Client.java:80)
03-23 12:47:37.940 888-916/? W/System.err﹕ at java.util.concurrent.FutureTask.run(FutureTask.java:237)
03-23 12:47:37.940 888-916/? W/System.err﹕ ... 1 more
After reading https://community.igniterealtime.org/thread/54520 I’ve tried each suggestion said there, but with no success. Does anybody have a clue for me? It would be appreciated!