Overview | Package | Class | Tree | Deprecated | Index | Help
| Compoze Software, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.compoze.util
Class TemporaryFileServer

    java.lang.Object
      com.compoze.util.TemporaryFileServer

public class TemporaryFileServer
extends java.lang.Object

This class is a server that listens for incoming requests to create and provide access to a temporary file. A new thread is created to handle each incoming request. The temporary file names may be either chosen by the client or generated by the server. When the name is chosen by the client, a unique temporary directory is created so that there will be no filename conflicts.
The process for connecting to the client is as follows:

1. Open the connection.
2. Present a header and a 64 byte random challenge to the client.
3. Verify that the client properly produces an SHA digest of the challenge and the password.
4. Accept the filename from the client or a request to generate one.
5. Create the local file and give the filename back to the client.
6. Write all data from the client into the file.
7. After receiving notification that the client is done, or after the connection to the client fails, delete the file.
8. Close the connection.

When running the `main()` method in this class, Java system properties may be specified to configure the server. The following table describes the effect of the different properties:

Property | Description | Required? | Default
password | Sets the password that clients must use to gain access to the server. | Yes | N/A
ip | Sets the IP address that the server listens on. | No | All local addresses
port | Sets the port that the server listens on. | No | 2112
tempdir | Sets the location of the temporary directory. | No | `java.io.tmpdir` Java system property
log | Sets whether or not logging is enabled (true/false). | No | true

See Also:
  `TemporaryFileClient`

Nested Class Summary
`class` | `TemporaryFileServer.ConnectionThread` This class implements a connection thread.

Field Summary
`static int` | `DEFAULT_PORT`

Constructor Summary
`TemporaryFileServer(java.net.InetAddress listenAddress, int iPort, java.lang.String sPassword, java.io.File tempDir, boolean bLog, boolean bSSL)` Constructor.

Method Summary
`static void` | `main(java.lang.String[] args)` Main.
`void` | `run()` Runs the server.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_PORT

    public static final int DEFAULT_PORT

See Also:
  Constant Field Values

Constructor Detail

### TemporaryFileServer

    public TemporaryFileServer(java.net.InetAddress listenAddress,
                               int iPort,
                               java.lang.String sPassword,
                               java.io.File tempDir,
                               boolean bLog,
                               boolean bSSL)
                        throws java.security.NoSuchAlgorithmException,
                               java.io.UnsupportedEncodingException

  Constructor.

Parameters:
  `listenAddress` - the listen IP address
  `iPort` - the server port
  `sPassword` - the server password
  `bLog` - if true, do logging
Throws:
  `java.security.NoSuchAlgorithmException` - if algorithm not supported
  `java.io.UnsupportedEncodingException` - if UTF-8 not supported

Method Detail

### run

    public void run()
             throws java.io.IOException

  Runs the server.

  Throws:
    `java.io.IOException` - if the server could not listen on the specified IP or port

### main

    public static void main(java.lang.String[] args)

  Main.

  Parameters:
    `args` - command line arguments

Overview | Package | Class | Tree | Deprecated | Index | Help
| Compoze Software, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright ©1999-2003 Compoze Software, Inc. All rights reserved.