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

Constructor Index

 o TftpServer()
Create a server on the local host address
 o TftpServer(InetAddress)
Creates a server on a given IP address

Method Index

 o 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.
 o getCreateDirectories()
Gets the create non-existent directories property
 o getInboundDirectory()
 o getMaxRetries()
Returns the current maximum retry count for future read and write requests
 o getOutboundDirectory()
 o getOverwrite()
Gets the overwrite property value
 o getTimeout()
Returns the current timeout parameter (in milliseconds)
 o getTraceLevel()
Returns the trace level
 o log(String)
Writes a message to the log, and to System.out
 o main(String[])
Runs an instance of the server
 o run()
The main loop for the server Normally, you would create a thread to run an instance of the TftpServer.
 o setCreateDirectories(boolean)
Sets the property that allows non-existent directories to be created
 o setInboundDirectory(File)
Sets the directory for inbound files (files written by clients)
 o setLog(PrintWriter)
Sets a file for writing log records.
 o setMaxRetries(int)
Sets the maximum retry count for future read and write requests
 o setOutboundDirectory(File)
Sets the directory for outbound files (files to be read by clients)
 o setOverwrite(boolean)
Sets the overwrite property True implies that existing files can be overwritten
 o setTimeout(int)
Sets the timeout parameter (in milliseconds) for future requests
 o setTraceLevel(int)
Sets the trace level

Constructors

 o TftpServer
 public TftpServer() throws SocketException, UnknownHostException
Create a server on the local host address

 o 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.

Methods

 o 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
 o getInboundDirectory
 public File getInboundDirectory()
 o 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.
 o getOutboundDirectory
 public File getOutboundDirectory()
 o 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
 o log
 public static void log(String msg)
Writes a message to the log, and to System.out

Parameters:
msg - the message to be logged
 o 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.

 o setMaxRetries
 public void setMaxRetries(int maxRetries)
Sets the maximum retry count for future read and write requests

 o getMaxRetries
 public int getMaxRetries()
Returns the current maximum retry count for future read and write requests

 o setTimeout
 public void setTimeout(int timeout)
Sets the timeout parameter (in milliseconds) for future requests

 o getTimeout
 public int getTimeout()
Returns the current timeout parameter (in milliseconds)

 o setTraceLevel
 public void setTraceLevel(int level)
Sets the trace level

 o getTraceLevel
 public int getTraceLevel()
Returns the trace level

 o setOverwrite
 public void setOverwrite(boolean canOverwriteExistingFiles)
Sets the overwrite property True implies that existing files can be overwritten

 o getOverwrite
 public boolean getOverwrite()
Gets the overwrite property value

 o setCreateDirectories
 public void setCreateDirectories(boolean createAllowed)
Sets the property that allows non-existent directories to be created

 o getCreateDirectories
 public boolean getCreateDirectories()
Gets the create non-existent directories property

 o 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
 o 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