File Transfer Problem (NegotiatorStream)

Hi all,

I writing a client xmpp to transfer files.

I saw discussions in this forum but i couldn"t find the answer to my problem.

When I try to send a File, The transfer is never started

Here is the code:

FileTransferManager ftm = new FileTransferManager(connection.getConnection());

File f = new File(filePath);

System.out.println("Transfer File: " + filePath + " to : " + to);

OutgoingFileTransfer oft = ftm.createOutgoingFileTransfer(to );

oft.sendFile(f, " msg");

System.out.println("transfer negotiatiated "+FileTransferNegotiator.isServiceEnabled(connection.getConnection()));

while (!oft.isDone()) {

if (oft.getStatus().equals(Status.error)) {

System.out.println("ERROR!!! " + oft.getError());

oft.cancel();

}

System.out.println(oft.getStatus());

System.out.println(oft.getProgress());

System.out.println(“sleeping 4 sec”);

try {

Thread.sleep(4000);

} catch (InterruptedException e) {

System.err.println("Error sleeping during OFT : " + e.getMessage());

}

}

In the trace I Find this bug:

transfer negotiatiated true

Negotiating Transfer

0.0

sleeping 4 sec

Negotiating Stream

0.0

sleeping 4 sec

Negotiating Stream

0.0

sleeping 4 sec

Exception in thread “File Transfer jsi_1782245567159098896” java.lang.NullPointerException

at org.jivesoftware.smack.XMPPConnection.createPacketCollector(XMPPConnection.java :826)

at org.jivesoftware.smackx.filetransfer.IBBTransferNegotiator.createOutgoingStream (IBBTransferNegotiator.java:112)

at org.jivesoftware.smackx.filetransfer.FaultTolerantNegotiator.createOutgoingStre am(FaultTolerantNegotiator.java:146)

at org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer.negotiateStream(Outgo ingFileTransfer.java:373)

at org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer.access$100(OutgoingFi leTransfer.java:35)

at org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer$2.run(OutgoingFileTra nsfer.java:214)

at java.lang.Thread.run(Thread.java:679)

Negotiating Stream

0.0

sleeping 4 sec

Negotiating Stream

0.0

sleeping 4 sec

Negotiating Stream …

Does someone have any idea about this bug.

Thanks in advance.

You may be encountering a bug SMACK-338 that has already been fixed in source but not released yet.

Thanks for your help.

But, I moved to use nightly build version instead of 3.2 release version.

But now, i have a now error:

Initial

0.0

sleeping 4 sec

couldn’t setup local SOCKS5 proxy on port 7777: Address already in use

couldn’t setup local SOCKS5 proxy on port 7777: Address already in use

couldn’t setup local SOCKS5 proxy on port 7777: Address already in use

Negotiating Stream

0.0

sleeping 4 sec

Negotiating Stream

0.0

sleeping 4 sec

Any idea please ?

Thanks

Hi!!

Try to see who is using that port. You can do it by using:

  • sudo lsof -i :7777

or

  • sudo netstat -pan | grep 7777

This way you’ll get the application that is using that port and its PID. If you think you don’t need it you can kill it. In my case an old intallation of openfire was still using it.

I hope this will help you.

Thanks for your answer. It really helps me.

I resolved the problem of port.

But, I’m still having the same error messages in negotiating stream (I’m using last smack nightly build version)

Initial

0.0

sleeping 4 sec

Negotiating Stream

0.0

sleeping 4 sec

Negotiating Stream

0.0

sleeping 4 sec

Negotiating Stream

0.0

sleeping 4 sec

…!!

I’m glad it helped you. At the end of this post you can see a solution I found for a very similar problem.

I don’t know if it is very correct but at least I managed to successfully transfer files. I hope it also works for you!!