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 Details

    • cvsId

      public static String cvsId
      Revision control id
    • sock

      protected ProxyServerSocket sock
      The underlying socket for Active connection.
    • acceptedSock

      protected StreamSocket acceptedSock
      The socket accepted from server.
    • sendBufferSize

      protected int sendBufferSize
  • Constructor Details

    • ProFTPActiveDataSocket

      public ProFTPActiveDataSocket(ProxyServerSocket sock)
      Constructor
      Parameters:
      sock - the server socket to use
  • Method Details

    • connect

      public void connect() throws IOException
      Specified by:
      connect in interface com.enterprisedt.net.ftp.internal.FTPDataSocket
      Throws:
      IOException
    • setTimeout

      public void setTimeout(int millis) throws IOException
      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:
      setTimeout in interface com.enterprisedt.net.ftp.internal.FTPDataSocket
      Parameters:
      millis - The length of the timeout, in milliseconds
      Throws:
      IOException
    • setReceiveBufferSize

      public void setReceiveBufferSize(int size) throws IOException
      Set the size of the data socket's receive buffer.
      Specified by:
      setReceiveBufferSize in interface com.enterprisedt.net.ftp.internal.FTPDataSocket
      Parameters:
      size - must be > 0
      Throws:
      IOException
    • setSendBufferSize

      public void setSendBufferSize(int size) throws IOException
      Set the size of the data socket's send buffer.
      Specified by:
      setSendBufferSize in interface com.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:
      getLocalPort in interface com.enterprisedt.net.ftp.internal.FTPDataSocket
      Returns:
      the local port number to which this socket is bound
    • getLocalAddress

      public InetAddress getLocalAddress()
      Returns the local address to which this socket is bound.
      Specified by:
      getLocalAddress in interface com.enterprisedt.net.ftp.internal.FTPDataSocket
      Returns:
      the local address to which this socket is bound
      Throws:
      IOException
    • acceptConnection

      protected void acceptConnection() throws IOException
      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

      public OutputStream getOutputStream() throws IOException
      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:
      getOutputStream in interface com.enterprisedt.net.ftp.internal.FTPDataSocket
      Returns:
      output stream for underlying socket.
      Throws:
      IOException
    • getInputStream

      public InputStream getInputStream() throws IOException
      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:
      getInputStream in interface com.enterprisedt.net.ftp.internal.FTPDataSocket
      Returns:
      input stream for underlying socket.
      Throws:
      IOException
    • close

      public void close() throws IOException
      Closes underlying sockets
      Specified by:
      close in interface com.enterprisedt.net.ftp.internal.FTPDataSocket
      Throws:
      IOException
    • closeChild

      public void closeChild() throws IOException
      Closes child socket
      Specified by:
      closeChild in interface com.enterprisedt.net.ftp.internal.FTPDataSocket
      Throws:
      IOException