FTPSClient,为远程和本地赋予什么值
FTPSClient, What values to give for Remote and Local
我是 FTPSClient 的新手,我正在尝试连接到在我的笔记本电脑中创建的 FTPS。我不完全了解某些方法的工作原理及其参数含义。
例如,
在我的代码中,我创建了一个 FTPSClient,如下所示:
FTPSClient ftps =new FTPSClient();
然后使用 connect() 方法和 ip 地址连接到服务器。
ftps.connect("172.xx.xx.xxx");
在每一步之后,我都会使用以下方法检查回复代码。
ftps.getReplyCode();
在下面的代码中我知道
用户名=系统用户名
password = 登录密码
ftps.login(username, password);
在 Internet Information Service(IIS) 的我的系统中。使用 ssl 创建了一个 ftp 服务器并给出了以下目录以供共享。
C:\Users\karan-pt2843\Desktop\FTPS
想将下面目录下的文件发送到服务器。
D:\sam.txt
现在我想在上面给定的目录中的服务器中存储一个文件,我尝试使用
remote="";
local="";
InputStream input;
input = new FileInputStream(local);
ftps.storeFile(remote, input);
input.close();
我不知道给远程和本地赋予什么价值。请帮助我了解赋予它们的价值以及内部发生的事情。
// Use passive mode as default because most of us are
// behind firewalls these days.
ftps.enterLocalPassiveMode();
...
String remote = "samFromClient.txt"; //Place on FTP
String input = "D:/sam.txt" //Place on your Client
//Your FTP reads from the inputstream and store the file on remote-path
InputStream input = new InputStream(new FileInputStream(input));
ftps.storeFile(remote, input);
input.close();
ftps.logout();
...
我是 FTPSClient 的新手,我正在尝试连接到在我的笔记本电脑中创建的 FTPS。我不完全了解某些方法的工作原理及其参数含义。 例如, 在我的代码中,我创建了一个 FTPSClient,如下所示:
FTPSClient ftps =new FTPSClient();
然后使用 connect() 方法和 ip 地址连接到服务器。
ftps.connect("172.xx.xx.xxx");
在每一步之后,我都会使用以下方法检查回复代码。
ftps.getReplyCode();
在下面的代码中我知道 用户名=系统用户名 password = 登录密码
ftps.login(username, password);
在 Internet Information Service(IIS) 的我的系统中。使用 ssl 创建了一个 ftp 服务器并给出了以下目录以供共享。
C:\Users\karan-pt2843\Desktop\FTPS
想将下面目录下的文件发送到服务器。
D:\sam.txt
现在我想在上面给定的目录中的服务器中存储一个文件,我尝试使用
remote="";
local="";
InputStream input;
input = new FileInputStream(local);
ftps.storeFile(remote, input);
input.close();
我不知道给远程和本地赋予什么价值。请帮助我了解赋予它们的价值以及内部发生的事情。
// Use passive mode as default because most of us are
// behind firewalls these days.
ftps.enterLocalPassiveMode();
...
String remote = "samFromClient.txt"; //Place on FTP
String input = "D:/sam.txt" //Place on your Client
//Your FTP reads from the inputstream and store the file on remote-path
InputStream input = new InputStream(new FileInputStream(input));
ftps.storeFile(remote, input);
input.close();
ftps.logout();
...