View Javadoc

    1   /*
    2    * Copyright 2001-2005 The Apache Software Foundation
    3    *
    4    * Licensed under the Apache License, Version 2.0 (the "License");
    5    * you may not use this file except in compliance with the License.
    6    * You may obtain a copy of the License at
    7    *
    8    *     http://www.apache.org/licenses/LICENSE-2.0
    9    *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   */
    16  package org.apache.commons.net;
    17
    18  import java.io.OutputStream;
    19
    20  /****
    21   * The DiscardTCPClient class is a TCP implementation of a client for the
    22   * Discard protocol described in RFC 863.  To use the class, merely
    23   * establish a connection with
    24   * {@link org.apache.commons.net.SocketClient#connect  connect }
    25   * and call {@link #getOutputStream  getOutputStream() } to
    26   * retrieve the discard output stream.  Don't close the output stream
    27   * when you're done writing to it.  Rather, call
    28   * {@link org.apache.commons.net.SocketClient#disconnect  disconnect }
    29   * to clean up properly.
    30   * <p>
    31   * <p>
    32   * @author Daniel F. Savarese
    33   * @see DiscardUDPClient
    34   ***/
    35
    36  public class DiscardTCPClient extends SocketClient
    37  {
    38      /**** The default discard port.  It is set to 9 according to RFC 863. ***/
    39      public static final int DEFAULT_PORT = 9;
    40
    41      /****
    42       * The default DiscardTCPClient constructor.  It merely sets the default
    43       * port to <code> DEFAULT_PORT </code>.
    44       ***/
    45      public DiscardTCPClient ()
    46      {
    47          setDefaultPort(DEFAULT_PORT);
    48      }
    49
    50      /****
    51       * Returns an OutputStream through which you may write data to the server.
    52       * You should NOT close the OutputStream when you're finished
    53       * reading from it.  Rather, you should call
    54       * {@link org.apache.commons.net.SocketClient#disconnect  disconnect }
    55       * to clean up properly.
    56       * <p>
    57       * @return An OutputStream through which you can write data to the server.
    58       ***/
    59      public OutputStream getOutputStream()
    60      {
    61          return _output_;
    62      }
    63  }