: Class FTPServer

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.dalsemi.shell.server.ftp
Class FTPServer

    java.lang.Object
      |
      +--java.lang.Thread
            |
            +--com.dalsemi.shell.server.Server
                  |
                  +--com.dalsemi.shell.server.ftp.FTPServer

public class FTPServer
extends Server

A simple server that uses FTP as described in RFC 959. This server uses a ServerSocket to listen on the specified port (defaults to port 21) for FTP connection requests. For each connection made, an FTP session is created. All command processing is handled by the FTP session, not this server.

Fields inherited from class com.dalsemi.shell.server.Server
`sessions, shutdown`

Fields inherited from class java.lang.Thread
`MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

Constructor Summary
`FTPServer()` Prepares the FTP server to listen on the well known FTP port (21).
`FTPServer(int port)` Prepares the FTP server to listen on an arbitrary port.

Method Summary
`protected Session` | `acceptNewSession()` Listens on the connection port for connection requests.
`void` | `broadcast(String sendThis)` This method does not apply to an FTPServer, so it does nothing.
`protected void` | `closeAllPorts()` Closes the ServerSocket used to listen for connections.
`static String` | `getConnectionMsgFile()` Gets the name of the file to be displayed when a user connects to this server.
`static String` | `getWelcomeMsgFile()` Gets the name of the file to be displayed when after a user logs in to this server.
`static boolean` | `isAnonymousAllowed()` Indicates whether anonymous login is allowed to this FTP server.
`static boolean` | `isRootAllowed()` Indicates whether root access is allowed to this FTP server.
`static String` | `logAnon()` Returns the name of the file where anonymous logins should be logged.

Methods inherited from class com.dalsemi.shell.server.Server
`checkForNewSessions, getConnectedUsers, run, sessionEnded, shutDown`

Methods inherited from class java.lang.Thread
`activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setDaemon, setName, setPriority, 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`

Constructor Detail

### FTPServer

    public FTPServer()
              throws IOException

  Prepares the FTP server to listen on the well known FTP port (21). The server will not be started and no connections will be accepted until its `run()` method is executed.

### FTPServer

    public FTPServer(int port)
              throws IOException

  Prepares the FTP server to listen on an arbitrary port. The server will not be started and no connections will be accepted until its `run()` method is executed.

Method Detail

### getConnectionMsgFile

    public static String getConnectionMsgFile()

  Gets the name of the file to be displayed when a user connects to this server. The contents of this file will be displayed before the login message. This file is specified by setting the "FTP_CONNECT" environment variable equal to the name of the file. This method will always return the value the variable had when the server was constructed. Changing the value of environment variable after creating the server will have no effect.
  Returns:
    the name of the connection file to display, or `null` if no connection file was specified

### getWelcomeMsgFile

    public static String getWelcomeMsgFile()

  Gets the name of the file to be displayed when after a user logs in to this server. This file is specified by setting the "FTP_WELCOME" environment variable equal to the name of the file. This method will always return the value the variable had when the server was constructed. Changing the value of environment variable after creating the server will have no effect.
  Returns:
    the name of the welcome file to display, or `null` if no welcome file was specified

### isAnonymousAllowed

    public static boolean isAnonymousAllowed()

  Indicates whether anonymous login is allowed to this FTP server. This is specified with the environment variable "FTP_ANON_ALLOWED". Set the variable to "false" to disallow anonymous login. All other values will be interpreted as `true` and anonymous logins will be accepted. This method will always return the value the variable had when the server was constructed. Changing the value of environment variable after creating the server will have no effect.
  Returns:
    `true` if anonymous is allowed to login

### isRootAllowed

    public static boolean isRootAllowed()

  Indicates whether root access is allowed to this FTP server. This is specified with the environment variable "FTP_ROOT_ALLOWED". Set the variable to "false" to disallow root login. All other values will be interpreted as `true` and root logins will be accepted. This method will always return the value the variable had when the server was constructed. Changing the value of environment variable after creating the server will have no effect.
  Returns:
    `true` if root is allowed to login

### logAnon

    public static String logAnon()

  Returns the name of the file where anonymous logins should be logged. This is specified with the environment variable "FTP_LOG_ANON". This method will always return the value the variable had when the server was constructed. Changing the value of environment variable after creating the server will have no effect.
  Returns:
    the name of the ftp log file, or `null` if none specified

### acceptNewSession

    protected Session acceptNewSession()

  Listens on the connection port for connection requests. Once a request is made, it creates, initializes, and returns a new FTPSession to handle that request. This method will block until a connection is made.
  Overrides:
    acceptNewSession in class Server
  Returns:
    a new `FTPSession`

### closeAllPorts

    protected void closeAllPorts()
                          throws IOException

  Closes the ServerSocket used to listen for connections.
  Overrides:
    closeAllPorts in class Server

### broadcast

    public void broadcast(String sendThis)

  This method does not apply to an FTPServer, so it does nothing.
  Overrides:
    broadcast in class Server
  Tags copied from class: Server
  Parameters:
    `sendThis` - message to send to all sessions

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD