I use this code to send file,and receiver is Spark.I got timeout error.
fun sendFile(connection: XMPPTCPConnection, receiver: String) {
val file = File("D:\\DOSBox-X\\dosbox-x.conf")
if (file.exists()) {
val transferManager = FileTransferManager.getInstanceFor(connection)
println(transferManager)
val receiverUid = JidCreate.entityFullFrom(
JidCreate.entityBareFrom(receiver),
Resourcepart.from("android")
)
val out = transferManager.createOutgoingFileTransfer(receiverUid)
out.sendFile(file, "file.name")
} else {
println("file not exist")
}
}
Error log:
sendFile: [Negotiating Transfer]:0.0
sendFile: [Negotiating Transfer]:0.0
sendFile: [Negotiating Stream]:0.0
sendFile: [Negotiating Stream]:0.0
org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 10000ms (~10s). StanzaCollector has been cancelled. Waited for response using: IQReplyFilter: iqAndIdFilter (AndFilter: (OrFilter: (IQTypeFilter: type=error, IQTypeFilter: type=result), StanzaIdFilter: id=217RA-52)), : fromFilter (OrFilter: (FromMatchesFilter (full): 1@im.imorning.cc/android)).
at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:281)
at org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamManager.establishSession(Socks5BytestreamManager.java:502)
at org.jivesoftware.smackx.filetransfer.Socks5TransferNegotiator.createOutgoingStream(Socks5TransferNegotiator.java:57)
at org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer.negotiateStream(OutgoingFileTransfer.java:380)
at org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer.access$100(OutgoingFileTransfer.java:44)
at org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer$2.run(OutgoingFileTransfer.java:232)
at java.lang.Thread.run(Thread.java:923)