1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.net;
17
18 import java.io.InputStream;
19
20 /***
21 * The EchoTCPClient class is a TCP implementation of a client for the
22 * Echo protocol described in RFC 862. To use the class, merely
23 * establish a connection with
24 * {@link org.apache.commons.net.SocketClient#connect connect }
25 * and call {@link DiscardTCPClient#getOutputStream getOutputStream() } to
26 * retrieve the echo output stream and
27 * {@link #getInputStream getInputStream() }
28 * to get the echo input stream.
29 * Don't close either stream when you're done using them. Rather, call
30 * {@link org.apache.commons.net.SocketClient#disconnect disconnect }
31 * to clean up properly.
32 * <p>
33 * <p>
34 * @author Daniel F. Savarese
35 * @see EchoUDPClient
36 * @see DiscardTCPClient
37 ***/
38
39 public final class EchoTCPClient extends DiscardTCPClient
40 {
41 /*** The default echo port. It is set to 7 according to RFC 862. ***/
42 public static final int DEFAULT_PORT = 7;
43
44 /***
45 * The default EchoTCPClient constructor. It merely sets the default
46 * port to <code> DEFAULT_PORT </code>.
47 ***/
48 public EchoTCPClient ()
49 {
50 setDefaultPort(DEFAULT_PORT);
51 }
52
53 /***
54 * Returns an InputStream from which you may read echoed data from
55 * the server. You should NOT close the InputStream when you're finished
56 * reading from it. Rather, you should call
57 * {@link org.apache.commons.net.SocketClient#disconnect disconnect }
58 * to clean up properly.
59 * <p>
60 * @return An InputStream from which you can read echoed data from the
61 * server.
62 ***/
63 public InputStream getInputStream()
64 {
65 return _input_;
66 }
67
68 }