我這個代碼掙扎:如何使用Smack發送文件?
FileTransferManager manager = new FileTransferManager(connection)
OutgoingFileTransfer transfer = manager.createOutgoingFileTransfer("[email protected]/Smack");
try {
System.out.println("000");
transfer.sendFile(new File("D:/cow.wav"), "Moo !");
System.out.println("111");
while(!transfer.isDone()) {
System.out.println(transfer.getProgress() + " is done!");
//System.out.println(transfer.getStreamID() + " is done!");
try {
Thread.sleep(1000);
}
catch (InterruptedException e) {
// TODO Auto-generated catch block e.printStackTrace();
}
}
}
catch (XMPPException e) {
// TODO Auto-generated catch block e.printStackTrace();
}
它接縫,它不能發送文件。
任何人都可以幫我解決這個問題嗎?