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
-
CONTROL_PORT
- The control port number for FTP
-
controlSock
- The underlying socket.
-
EOL
- Standard FTP end of line sequence
-
reader
- The reader that reads control data from the
control socket
-
writer
- The write that writes to the control socket
-
FTPControlSocket(InetAddress)
- Constructor.
-
FTPControlSocket(String)
- Constructor.
-
createDataSocket()
- Request a data socket be created on the
server, connect to it and return our
connected socket.
-
initStreams()
- Obtain the reader/writer streams for this
connection
-
logout()
- Quit this FTP session and clean up.
-
readReply()
- Read the FTP server's reply to a previously
issued command.
-
sendCommand(String)
- Send a command to the FTP server and
return the server's reply
-
validateConnection()
- Checks that the standard 220 reply is returned
following the initiated connection
-
validateReply(String, String)
- Validate the response the host has supplied against the
expected reply.
EOL
static final String EOL
- Standard FTP end of line sequence
CONTROL_PORT
private static final int CONTROL_PORT
- The control port number for FTP
controlSock
private Socket controlSock
- The underlying socket.
writer
private Writer writer
- The write that writes to the control socket
reader
private BufferedReader reader
- The reader that reads control data from the
control socket
FTPControlSocket
public FTPControlSocket(String remoteHost) throws IOException, FTPException
- Constructor. Performs TCP connection and
sets up reader/writer
- Parameters:
- remoteHost - Remote hostname
FTPControlSocket
public FTPControlSocket(InetAddress remoteAddr) throws IOException, FTPException
- Constructor. Performs TCP connection and
sets up reader/writer
- Parameters:
- remoteAddr - Remote inet address
validateConnection
private void validateConnection() throws IOException, FTPException
- Checks that the standard 220 reply is returned
following the initiated connection
initStreams
private void initStreams() throws IOException
- Obtain the reader/writer streams for this
connection
logout
public void logout() throws IOException
- Quit this FTP session and clean up.
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
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
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
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