01: /*
02: * Copyright 2001-2005 The Apache Software Foundation
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: /*** The default discard port. It is set to 9 according to RFC 863. ***/
38: public static final int DEFAULT_PORT = 9;
39:
40: /***
41: * The default DiscardTCPClient constructor. It merely sets the default
42: * port to <code> DEFAULT_PORT </code>.
43: ***/
44: public DiscardTCPClient() {
45: setDefaultPort(DEFAULT_PORT);
46: }
47:
48: /***
49: * Returns an OutputStream through which you may write data to the server.
50: * You should NOT close the OutputStream when you're finished
51: * reading from it. Rather, you should call
52: * {@link org.apache.commons.net.SocketClient#disconnect disconnect }
53: * to clean up properly.
54: * <p>
55: * @return An OutputStream through which you can write data to the server.
56: ***/
57: public OutputStream getOutputStream() {
58: return _output_;
59: }
60: }
|