List of usage examples for org.apache.commons.net.tftp TFTPClient setDatagramSocketFactory
public void setDatagramSocketFactory(DatagramSocketFactory factory)
From source file:org.xerela.net.sim.tftp.TftpInterface.java
public void sendFile(IpAddress localIp, IpAddress remoteIp, String filename, InputStream file) throws UnknownHostException, IOException { TFTPClient client = null; try {/*from w w w . j a v a 2 s. c o m*/ client = new TFTPClient(); client.setDatagramSocketFactory(new SocketFactory(localIp.getRealAddress())); client.open(); client.sendFile(filename, TFTPClient.BINARY_MODE, file, remoteIp.getIp()); } finally { try { client.close(); } catch (NullPointerException e) { } } }