我正在尝试连接到FTP服务器。我希望确认我已联系。
这是我的代码:
package no.ftptesting.oversikt;
import java.io.IOException;
import java.net.SocketException;
import android.app.Activity;
import android.os.Bundle;
import org.apache.commons.net.ftp.FTPClient;
public class ftptestingActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
FTPClient ftp;
ftp = new FTPClient();
try {
int reply;
ftp.connect("server",21);
System.out.println("Connected.");
reply = ftp.getReplyCode();
} catch (SocketException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
我想在屏幕上打印出确认和回复整数。我怎么能这样做?
答案 0 :(得分:1)