Package com.enterprisedt.net.ftp.pro
Class ProFTPActiveDataSocket
java.lang.Object
com.enterprisedt.net.ftp.pro.ProFTPActiveDataSocket
- All Implemented Interfaces:
com.enterprisedt.net.ftp.internal.FTPDataSocket
public class ProFTPActiveDataSocket
extends Object
implements com.enterprisedt.net.ftp.internal.FTPDataSocket
Active data socket handling class
- Version:
- $Revision$
- Author:
- Bruce Blackshaw
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StreamSocketThe socket accepted from server.static StringRevision control idprotected intprotected ProxyServerSocketThe underlying socket for Active connection. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidWaits for a connection from the server and then sets the timeout when the connection is made.voidclose()Closes underlying socketsvoidCloses child socketvoidconnect()If active mode, accepts the FTP server's connection - in PASV, we are already connected.Returns the local address to which this socket is bound.intReturns the local port to which this socket is bound.If active mode, accepts the FTP server's connection - in PASV, we are already connected.voidsetReceiveBufferSize(int size) Set the size of the data socket's receive buffer.voidsetSendBufferSize(int size) Set the size of the data socket's send buffer.voidsetTimeout(int millis) Set the TCP timeout on the underlying data socket(s).
-
Field Details
-
cvsId
Revision control id -
sock
The underlying socket for Active connection. -
acceptedSock
The socket accepted from server. -
sendBufferSize
protected int sendBufferSize
-
-
Constructor Details
-
ProFTPActiveDataSocket
Constructor- Parameters:
sock- the server socket to use
-
-
Method Details
-
connect
- Specified by:
connectin interfacecom.enterprisedt.net.ftp.internal.FTPDataSocket- Throws:
IOException
-
setTimeout
Set the TCP timeout on the underlying data socket(s). If a timeout is set, then any operation which takes longer than the timeout value will be killed with a java.io.InterruptedException.- Specified by:
setTimeoutin interfacecom.enterprisedt.net.ftp.internal.FTPDataSocket- Parameters:
millis- The length of the timeout, in milliseconds- Throws:
IOException
-
setReceiveBufferSize
Set the size of the data socket's receive buffer.- Specified by:
setReceiveBufferSizein interfacecom.enterprisedt.net.ftp.internal.FTPDataSocket- Parameters:
size- must be > 0- Throws:
IOException
-
setSendBufferSize
Set the size of the data socket's send buffer.- Specified by:
setSendBufferSizein interfacecom.enterprisedt.net.ftp.internal.FTPDataSocket- Parameters:
size- must be > 0- Throws:
IOException
-
getLocalPort
public int getLocalPort()Returns the local port to which this socket is bound.- Specified by:
getLocalPortin interfacecom.enterprisedt.net.ftp.internal.FTPDataSocket- Returns:
- the local port number to which this socket is bound
-
getLocalAddress
Returns the local address to which this socket is bound.- Specified by:
getLocalAddressin interfacecom.enterprisedt.net.ftp.internal.FTPDataSocket- Returns:
- the local address to which this socket is bound
- Throws:
IOException
-
acceptConnection
Waits for a connection from the server and then sets the timeout when the connection is made.- Throws:
IOException- There was an error while waiting for or accepting a connection from the server.
-
getOutputStream
If active mode, accepts the FTP server's connection - in PASV, we are already connected. Then gets the output stream of the connection- Specified by:
getOutputStreamin interfacecom.enterprisedt.net.ftp.internal.FTPDataSocket- Returns:
- output stream for underlying socket.
- Throws:
IOException
-
getInputStream
If active mode, accepts the FTP server's connection - in PASV, we are already connected. Then gets the input stream of the connection- Specified by:
getInputStreamin interfacecom.enterprisedt.net.ftp.internal.FTPDataSocket- Returns:
- input stream for underlying socket.
- Throws:
IOException
-
close
Closes underlying sockets- Specified by:
closein interfacecom.enterprisedt.net.ftp.internal.FTPDataSocket- Throws:
IOException
-
closeChild
Closes child socket- Specified by:
closeChildin interfacecom.enterprisedt.net.ftp.internal.FTPDataSocket- Throws:
IOException
-