|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
com.Prominic.jFTPd.PassiveConnection
public class PassiveConnection
This thread takes care of opening a passive connection when the FTP client
requests this using the PASV command. jFTPd needs to open a local socket
which will be reported to the client, and the client needs to be informed
about the new data socket as a response to the PASV command.
It knows to only open a socket using a predefined range of ports (for
firewall friendly behaviour - when you can open tunnels from the firewall
back to jFTPd on the specified range of ports).
By default, it waits for 60 seconds for the client to connect back, otherwise
it will drop the socket and notify the client (timeouts always happen due to
a misconfigured firewall - mostly on the server side )
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
(package private) boolean |
DEBUG
|
(package private) static int |
highPort
|
(package private) static int |
lowPort
|
(package private) static int |
maxTries
|
(package private) static int |
nextPort
|
(package private) int |
port
|
(package private) static boolean[] |
portsUsed
|
(package private) java.net.Socket |
sock
|
(package private) java.net.ServerSocket |
ss
|
(package private) int |
stage
|
(package private) static int |
timeout
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
PassiveConnection()
Creates a passive connection. |
Method Summary | |
---|---|
int |
getPort()
Gets the port chosen by the passive connection (to report it back to the user) |
java.net.Socket |
getSocket()
Gets the socket opened by the passive connection (to use it to exchange data with the client). |
int |
getStage()
Gets the stage of the passive connection. |
static int |
getTimeout()
Gets the timeout value. |
void |
run()
Starts the passive connection which awaits a connection from the client for the specified timeout. |
static void |
setPortRange(int low,
int high)
This sets the ports range from which the PassiveConnection can select ports. |
static void |
setTimeout(int newTimeout)
Sets new timeout value for which the PassiveConnection will wait for a connection from the client. |
protected void |
setupListener()
This method will try to find an empty port (either guessing or picking one from the range of allowed ports). |
void |
terminate()
Terminates the passive connection and closes the sockets. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
final boolean DEBUG
java.net.Socket sock
int port
java.net.ServerSocket ss
int stage
static int lowPort
static int highPort
static boolean[] portsUsed
static int nextPort
static final int maxTries
static int timeout
Constructor Detail |
---|
public PassiveConnection()
Method Detail |
---|
public int getPort()
public java.net.Socket getSocket()
public int getStage()
public static int getTimeout()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public static void setPortRange(int low, int high)
low
- - low indexhigh
- - high index.public static void setTimeout(int newTimeout)
protected void setupListener()
public void terminate()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |