transfer.sendFile(file, "Demo Image");
FileTransferManager manager = new FileTransferManager(connection); OutgoingFileTransfer transfer = manager.createOutgoingFileTransfer("usre2@myHost/Smack"); File file = new File(filenameWithPath); try { transfer.sendFile(file, "test_file"); } catch (XMPPException e) { e.printStackTrace(); } while(!transfer.isDone()) { if(transfer.getStatus().equals(Status.error)) { System.out.println("ERROR!!! " + transfer.getError()); } else if (transfer.getStatus().equals(Status.cancelled) || transfer.getStatus().equals(Status.refused)) { System.out.println("Cancelled!!! " + transfer.getError()); } try { Thread.sleep(1000L); } catch (InterruptedException e) { e.printStackTrace(); } } if(transfer.getStatus().equals(Status.refused) || transfer.getStatus().equals(Status.error) || transfer.getStatus().equals(Status.cancelled)){ System.out.println("refused cancelled error " + transfer.getError()); } else { System.out.println("Success"); }
File file = new File(transfer.getFilePath()); transfer = transferManager.createOutgoingFileTransfer(fullJID); transfer.sendFile(file, "Sending");
@Override public SampleResult perform(JMeterXMPPSampler sampler, SampleResult res) throws Exception { String recipient = sampler.getPropertyAsString(FILE_RECIPIENT); String filePath = sampler.getPropertyAsString(FILE_PATH); res.setSamplerData("Recipient: " + recipient + "\r\nFile: " + filePath + "\r\n"); OutgoingFileTransfer transfer = mgr.createOutgoingFileTransfer(recipient); transfer.sendFile(new File(filePath), filePath); waitForTransfer(transfer, sampler.getXMPPConnection().getPacketReplyTimeout()); res.setResponseData(("Bytes sent: " + transfer.getBytesSent()).getBytes()); return res; }
File file = new File(file_path); try { transfer.sendFile(file, "test_file"); } catch (XMPPException e) { e.printStackTrace();
transfer.sendFile(file, "test_file"); } catch (XMPPException e) { e.printStackTrace();
transfer.sendFile(file, "Sending file");
Log.d("file sending",file.getAbsolutePath()+" "+file.getName()); configureProviderManager(connection); transfer.sendFile(file, "test_file"); } catch (XMPPException e) { e.printStackTrace();