Preview

Ftp Server

Better Essays
Open Document
Open Document
4247 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Ftp Server
///////////////////A program to demonstrate FTP server to Server communication.
/*
* Copyright 2001-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package examples;

import java.io.IOException; import java.io.PrintWriter; import java.net.InetAddress; import org.apache.commons.net.ProtocolCommandListener; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPReply;

/*** * This is an example program demonstrating how to use the FTPClient class. * This program arranges a server to server file transfer that transfers * a file from host1 to host2. Keep in mind, this program might only work * if host2 is the same as the host you run it on (for security reasons, * some ftp servers only allow PORT commands to be issued with a host * argument equal to the client host). * <p> * Usage: ftp <host1> <user1> <pass1> <file1> <host2> <user2> <pass2> <file2> * <p> ***/ public class server2serverFTP
{

public static final void main(String[] args) { String server1, username1, password1, file1; String server2, username2, password2, file2; FTPClient ftp1, ftp2; ProtocolCommandListener listener;

if (args.length < 8) { System.err.println( "Usage: ftp <host1> <user1> <pass1> <file1> <host2> <user2> <pass2> <file2>" ); System.exit(1); }

server1 = args[0]; username1 =

You May Also Find These Documents Helpful