Return-Path: Delivered-To: apmail-commons-commits-archive@locus.apache.org Received: (qmail 89387 invoked from network); 8 Mar 2008 20:34:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Mar 2008 20:34:29 -0000 Received: (qmail 74872 invoked by uid 500); 8 Mar 2008 20:34:24 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 74724 invoked by uid 500); 8 Mar 2008 20:34:24 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 74715 invoked by uid 99); 8 Mar 2008 20:34:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 Mar 2008 12:34:24 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 Mar 2008 20:33:44 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B4CB21A9838; Sat, 8 Mar 2008 12:34:04 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r635074 - /commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/tftp/TFTPServer.java Date: Sat, 08 Mar 2008 20:34:04 -0000 To: commits@commons.apache.org From: rwinston@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080308203404.B4CB21A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rwinston Date: Sat Mar 8 12:34:02 2008 New Revision: 635074 URL: http://svn.apache.org/viewvc?rev=635074&view=rev Log: Move main method to example Javadoc block Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/tftp/TFTPServer.java Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/tftp/TFTPServer.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/tftp/TFTPServer.java?rev=635074&r1=635073&r2=635074&view=diff ============================================================================== --- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/tftp/TFTPServer.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/tftp/TFTPServer.java Sat Mar 8 12:34:02 2008 @@ -25,7 +25,6 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintStream; import java.net.SocketTimeoutException; @@ -50,6 +49,33 @@ * By default, logs debug info and errors to the console streams. This can be changed with the * setLog and setLogError methods. * + *

+ * Example usage is below: + * + * + * public static void main(String[] args) throws Exception + * { + * if (args.length != 1) + * { + * System.out + * .println("You must provide 1 argument - the base path for the server to serve from."); + * System.exit(1); + * } + * + * TFTPServer ts = new TFTPServer(new File(args[0]), new File(args[0]), GET_AND_PUT); + * ts.setSocketTimeout(2000); + * + * System.out.println("TFTP Server running. Press enter to stop."); + * new InputStreamReader(System.in).read(); + * + * ts.shutdown(); + * System.out.println("Server shut down."); + * System.exit(0); + * } + * + * + * + * * @author Dan Armbrust */ @@ -77,26 +103,6 @@ private int maxTimeoutRetries_ = 3; private int socketTimeout_; - - public static void main(String[] args) throws Exception - { - if (args.length != 1) - { - System.out - .println("You must provide 1 argument - the base path for the server to serve from."); - System.exit(1); - } - - TFTPServer ts = new TFTPServer(new File(args[0]), new File(args[0]), GET_AND_PUT); - ts.setSocketTimeout(2000); - - System.out.println("TFTP Server running. Press enter to stop."); - new InputStreamReader(System.in).read(); - - ts.shutdown(); - System.out.println("Server shut down."); - System.exit(0); - } /** * Start a TFTP Server on the default port (69). Gets and Puts occur in the specified