问题如题,在sendfile这一步出错
package Examples;import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.UnknownHostException;
import org.apache.commons.net.tftp.TFTP;
import org.apache.commons.net.tftp.TFTPClient;public class tftpclient {
public final static void main(String[] args) {
FileInputStream input = null;
TFTPClient test = new TFTPClient(); try {
input = new FileInputStream("123.txt");
} catch (FileNotFoundException e) {
e.printStackTrace();
} try {
test.sendFile("456.txt", TFTP.ASCII_MODE, input, "127.0.0.1");
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}}
package Examples;import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.UnknownHostException;
import org.apache.commons.net.tftp.TFTP;
import org.apache.commons.net.tftp.TFTPClient;public class tftpclient {
public final static void main(String[] args) {
FileInputStream input = null;
TFTPClient test = new TFTPClient(); try {
input = new FileInputStream("123.txt");
} catch (FileNotFoundException e) {
e.printStackTrace();
} try {
test.sendFile("456.txt", TFTP.ASCII_MODE, input, "127.0.0.1");
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}}
http://www.java2s.com/Code/Java/Network-Protocol/AsimpleJavatftpclient.htm问题:可以接收,不可以发送!
不报错
我用的server端是cisco tftp server我运行时的参数:-s -a 127.0.0.1 g:\java\123.txt fromclient.txt