All Packages Class Hierarchy This Package Previous Next Index
Class com.ibm.nways.tools.tftp.TftpServer
java.lang.Object
|
+----com.ibm.nways.tools.tftp.TftpServer
- public class TftpServer
- extends Object
- implements Runnable
Thde TftpServer class implements the base functions for the
Trivial File Transfer Protocol.
- Version:
- 1.13
- Author:
- Michael Gering
-
TftpServer()
- Create a server on the local host address
-
TftpServer(InetAddress)
- Creates a server on a given IP address
-
destroy()
- Terminate the server at the next convenient stopping place
Sets a flag that the server will test, causing it to finish its work
and return from the run() method.
-
getCreateDirectories()
- Gets the create non-existent directories property
-
getInboundDirectory()
-
-
getMaxRetries()
- Returns the current maximum retry count for future read and write requests
-
getOutboundDirectory()
-
-
getOverwrite()
- Gets the overwrite property value
-
getTimeout()
- Returns the current timeout parameter (in milliseconds)
-
getTraceLevel()
- Returns the trace level
-
log(String)
- Writes a message to the log, and to System.out
-
main(String[])
- Runs an instance of the server
-
run()
- The main loop for the server
Normally, you would create a thread to run an instance of the TftpServer.
-
setCreateDirectories(boolean)
- Sets the property that allows non-existent directories to be created
-
setInboundDirectory(File)
- Sets the directory for inbound files (files written by clients)
-
setLog(PrintWriter)
- Sets a file for writing log records.
-
setMaxRetries(int)
- Sets the maximum retry count for future read and write requests
-
setOutboundDirectory(File)
- Sets the directory for outbound files (files to be read by clients)
-
setOverwrite(boolean)
- Sets the overwrite property
True implies that existing files can be overwritten
-
setTimeout(int)
- Sets the timeout parameter (in milliseconds) for future requests
-
setTraceLevel(int)
- Sets the trace level
TftpServer
public TftpServer() throws SocketException, UnknownHostException
- Create a server on the local host address
TftpServer
public TftpServer(InetAddress laddr) throws SocketException
- Creates a server on a given IP address
- Parameters:
- laddr - an IP address local to this machine to which
the server will bind.
setInboundDirectory
public void setInboundDirectory(File inDir)
- Sets the directory for inbound files (files written by clients)
- Parameters:
- inDir - the File specifying a directory. If null,
then clients are prevented from writing any files to the server
getInboundDirectory
public File getInboundDirectory()
setOutboundDirectory
public void setOutboundDirectory(File outDir)
- Sets the directory for outbound files (files to be read by clients)
- Parameters:
- outDir - the File specifying a directory. If null,
then clients are prevented from reading any files from the server.
getOutboundDirectory
public File getOutboundDirectory()
setLog
public static void setLog(PrintWriter logWriter)
- Sets a file for writing log records.
If a log is already in operation, it will be closed.
- Parameters:
- logWriter - the PrintWriter for the log. If null, log
records will be sent only to System.out
log
public static void log(String msg)
- Writes a message to the log, and to System.out
- Parameters:
- msg - the message to be logged
destroy
public void destroy()
- Terminate the server at the next convenient stopping place
Sets a flag that the server will test, causing it to finish its work
and return from the run() method.
setMaxRetries
public void setMaxRetries(int maxRetries)
- Sets the maximum retry count for future read and write requests
getMaxRetries
public int getMaxRetries()
- Returns the current maximum retry count for future read and write requests
setTimeout
public void setTimeout(int timeout)
- Sets the timeout parameter (in milliseconds) for future requests
getTimeout
public int getTimeout()
- Returns the current timeout parameter (in milliseconds)
setTraceLevel
public void setTraceLevel(int level)
- Sets the trace level
getTraceLevel
public int getTraceLevel()
- Returns the trace level
setOverwrite
public void setOverwrite(boolean canOverwriteExistingFiles)
- Sets the overwrite property
True implies that existing files can be overwritten
getOverwrite
public boolean getOverwrite()
- Gets the overwrite property value
setCreateDirectories
public void setCreateDirectories(boolean createAllowed)
- Sets the property that allows non-existent directories to be created
getCreateDirectories
public boolean getCreateDirectories()
- Gets the create non-existent directories property
run
public void run()
- The main loop for the server
Normally, you would create a thread to run an instance of the TftpServer.
The Thread.start() method then invokes this method. You can also
call this method directly. The server runs continuously until the
destroy method is called.
- See Also:
- destroy
main
public static void main(String args[])
- Runs an instance of the server
- Parameters:
- args - runtime arguments may be specified; arguments
override any corresponding properties in the properties file.
Valid arguments:
- -help
- -outbound dir
- -inbound dir
- -addr ipaddress
- -log filename
All Packages Class Hierarchy This Package Previous Next Index