net.sf.hermesftp.cmd
Class PassiveModeSocketProvider

java.lang.Object
  extended by net.sf.hermesftp.cmd.PassiveModeSocketProvider
All Implemented Interfaces:
SocketProvider

public class PassiveModeSocketProvider
extends java.lang.Object
implements SocketProvider

Provides the data transfer socket for transfer passive mode.

Author:
Behnke

Constructor Summary
PassiveModeSocketProvider(FtpSessionContext ctx, int preferredProtocol)
          Constructor.
 
Method Summary
 void closeSocket()
          Closes the socket, if necessary.
 DataChannelInfo init()
          Initializes the provider.
 java.net.Socket provideSocket()
          Provides the socket for data transfer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PassiveModeSocketProvider

public PassiveModeSocketProvider(FtpSessionContext ctx,
                                 int preferredProtocol)
Constructor.

Parameters:
ctx - Session context.
preferredProtocol - Preferred protocol (IPv4 or IPv6)
Method Detail

init

public DataChannelInfo init()
                     throws java.io.IOException
Initializes the provider.

Specified by:
init in interface SocketProvider
Returns:
Information about the data channel is provided.
Throws:
java.io.IOException - Error on initializing the data channel.

closeSocket

public void closeSocket()
Closes the socket, if necessary.

Specified by:
closeSocket in interface SocketProvider

provideSocket

public java.net.Socket provideSocket()
                              throws java.io.IOException
Provides the socket for data transfer. Multiple calls of this method do not result in multiple socket instance. One instance is created and cached.

Specified by:
provideSocket in interface SocketProvider
Returns:
The Socket.
Throws:
java.io.IOException - Error on creating the data channel.


Copyright © 2005-2007 Lars Behnke. All Rights Reserved.