1. /*
  2. * Copyright 2001-2004 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. import java.io.OutputStream;
  18. /***
  19. * The DiscardTCPClient class is a TCP implementation of a client for the
  20. * Discard protocol described in RFC 863. To use the class, merely
  21. * establish a connection with
  22. * <a href="org.apache.commons.net.SocketClient.html#connect"> connect </a>
  23. * and call <a href="#getOutputStream"> getOutputStream() </a> to
  24. * retrieve the discard output stream. Don't close the output stream
  25. * when you're done writing to it. Rather, call
  26. * <a href="org.apache.commons.net.SocketClient.html#disconnect"> disconnect </a>
  27. * to clean up properly.
  28. * <p>
  29. * <p>
  30. * @author Daniel F. Savarese
  31. * @see DiscardUDPClient
  32. ***/
  33. public class DiscardTCPClient extends SocketClient
  34. {
  35. /*** The default discard port. It is set to 9 according to RFC 863. ***/
  36. public static final int DEFAULT_PORT = 9;
  37. /***
  38. * The default DiscardTCPClient constructor. It merely sets the default
  39. * port to <code> DEFAULT_PORT </code>.
  40. ***/
  41. public DiscardTCPClient ()
  42. {
  43. setDefaultPort(DEFAULT_PORT);
  44. }
  45. /***
  46. * Returns an OutputStream through which you may write data to the server.
  47. * You should NOT close the OutputStream when you're finished
  48. * reading from it. Rather, you should call
  49. * <a href="org.apache.commons.net.SocketClient.html#disconnect"> disconnect </a>
  50. * to clean up properly.
  51. * <p>
  52. * @return An OutputStream through which you can write data to the server.
  53. ***/
  54. public OutputStream getOutputStream()
  55. {
  56. return _output_;
  57. }
  58. }