001 /* 002 * Copyright 2001-2005 The Apache Software Foundation 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.apache.commons.net; 017 018 import java.io.OutputStream; 019 020 /*** 021 * The DiscardTCPClient class is a TCP implementation of a client for the 022 * Discard protocol described in RFC 863. To use the class, merely 023 * establish a connection with 024 * {@link org.apache.commons.net.SocketClient#connect connect } 025 * and call {@link #getOutputStream getOutputStream() } to 026 * retrieve the discard output stream. Don't close the output stream 027 * when you're done writing to it. Rather, call 028 * {@link org.apache.commons.net.SocketClient#disconnect disconnect } 029 * to clean up properly. 030 * <p> 031 * <p> 032 * @author Daniel F. Savarese 033 * @see DiscardUDPClient 034 ***/ 035 036 public class DiscardTCPClient extends SocketClient 037 { 038 /*** The default discard port. It is set to 9 according to RFC 863. ***/ 039 public static final int DEFAULT_PORT = 9; 040 041 /*** 042 * The default DiscardTCPClient constructor. It merely sets the default 043 * port to <code> DEFAULT_PORT </code>. 044 ***/ 045 public DiscardTCPClient () 046 { 047 setDefaultPort(DEFAULT_PORT); 048 } 049 050 /*** 051 * Returns an OutputStream through which you may write data to the server. 052 * You should NOT close the OutputStream when you're finished 053 * reading from it. Rather, you should call 054 * {@link org.apache.commons.net.SocketClient#disconnect disconnect } 055 * to clean up properly. 056 * <p> 057 * @return An OutputStream through which you can write data to the server. 058 ***/ 059 public OutputStream getOutputStream() 060 { 061 return _output_; 062 } 063 }