All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.enterprisedt.net.ftp.FTPControlSocket

java.lang.Object
   |
   +----com.enterprisedt.net.ftp.FTPControlSocket

public class FTPControlSocket
extends Object
Supports client-side FTP operations

Author:
Bruce Blackshaw

Variable Index

 o CONTROL_PORT
The control port number for FTP
 o controlSock
The underlying socket.
 o EOL
Standard FTP end of line sequence
 o reader
The reader that reads control data from the control socket
 o writer
The write that writes to the control socket

Constructor Index

 o FTPControlSocket(InetAddress)
Constructor.
 o FTPControlSocket(String)
Constructor.

Method Index

 o createDataSocket()
Request a data socket be created on the server, connect to it and return our connected socket.
 o initStreams()
Obtain the reader/writer streams for this connection
 o logout()
Quit this FTP session and clean up.
 o readReply()
Read the FTP server's reply to a previously issued command.
 o sendCommand(String)
Send a command to the FTP server and return the server's reply
 o validateConnection()
Checks that the standard 220 reply is returned following the initiated connection
 o validateReply(String, String)
Validate the response the host has supplied against the expected reply.

Variables

 o EOL
 static final String EOL
Standard FTP end of line sequence

 o CONTROL_PORT
 private static final int CONTROL_PORT
The control port number for FTP

 o controlSock
 private Socket controlSock
The underlying socket.

 o writer
 private Writer writer
The write that writes to the control socket

 o reader
 private BufferedReader reader
The reader that reads control data from the control socket

Constructors

 o FTPControlSocket
 public FTPControlSocket(String remoteHost) throws IOException, FTPException
Constructor. Performs TCP connection and sets up reader/writer

Parameters:
remoteHost - Remote hostname
 o FTPControlSocket
 public FTPControlSocket(InetAddress remoteAddr) throws IOException, FTPException
Constructor. Performs TCP connection and sets up reader/writer

Parameters:
remoteAddr - Remote inet address

Methods

 o validateConnection
 private void validateConnection() throws IOException, FTPException
Checks that the standard 220 reply is returned following the initiated connection

 o initStreams
 private void initStreams() throws IOException
Obtain the reader/writer streams for this connection

 o logout
 public void logout() throws IOException
Quit this FTP session and clean up.

 o createDataSocket
 Socket createDataSocket() throws IOException, FTPException
Request a data socket be created on the server, connect to it and return our connected socket.

Returns:
connected data socket
 o sendCommand
 String sendCommand(String command) throws IOException
Send a command to the FTP server and return the server's reply

Returns:
reply to the supplied command
 o readReply
 String readReply() throws IOException
Read the FTP server's reply to a previously issued command. RFC 959 states that a reply consists of the 3 digit code followed by text. The 3 digit code is followed by a hyphen if it is a muliline response, and the last line starts with the same 3 digit code.

Returns:
reply string
 o validateReply
 void validateReply(String reply,
                    String expectedReplyCode) throws IOException, FTPException
Validate the response the host has supplied against the expected reply. If we get an unexpected reply we throw an exception, setting the message to that returned by the FTP server

Parameters:
reply - the entire reply string we received
expectedReplyCode - the reply we expected to receive

All Packages  Class Hierarchy  This Package  Previous  Next  Index