Hey!

Given more than 100 computers collecting test lab data.  Each has a
directory named C shared-out to the network, where log files are written
out to flat files.  Another computer collects all of the data from each
of the lab computers and stores it in a database.  A servlet provides
access to the data to the Web browser.  The log files are not sent to
the database computer, but reside on the test lab computers.

Does it make sense to do this:
Install a TFTP server on each of the test lab computers.
Instantiate a URL connection.
Get the log file.

The servlet code to get the log files like this:

...
 String host ="Lab1";                        // the name of the lab
computer
 String log="Log1.log";                    //the log file
 String url = "ftp://" +host+ "/" +log";
 try { this.theURL = new URL(url); }
 catch ( MalformedURLException e) {
   System.out.println("Bad URL: " + theURL);
 }
...
...
 URLConnection conn = null;
 DataInputStream data = null;
 String line;
 StringBuffer buf = new StringBuffer();

 try {
   conn = this.theURL.openConnection();
   conn.connect();

   //Connection opened...
   data = new DataInputStream(new BufferedInputStream(
       conn.getInputStream()));

    // get the log file
   while ((line = data.readLine()) != null) {
   buf.append(line + "\n");
   }
 }
 catch (IOException e) {
   System.out.println("IO Error:" + e.getMessage());
 }

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to