IdDiscardServer.pas 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. {
  2. $Project$
  3. $Workfile$
  4. $Revision$
  5. $DateUTC$
  6. $Id$
  7. This file is part of the Indy (Internet Direct) project, and is offered
  8. under the dual-licensing agreement described on the Indy website.
  9. (http://www.indyproject.org/)
  10. Copyright:
  11. (c) 1993-2005, Chad Z. Hower and the Indy Pit Crew. All rights reserved.
  12. }
  13. {
  14. $Log$
  15. }
  16. {
  17. Rev 1.8 12/2/2004 4:23:50 PM JPMugaas
  18. Adjusted for changes in Core.
  19. Rev 1.7 1/21/2004 2:12:46 PM JPMugaas
  20. InitComponent
  21. Rev 1.6 2003.11.29 10:18:48 AM czhower
  22. Updated for core change to InputBuffer.
  23. Rev 1.5 3/6/2003 5:08:48 PM SGrobety
  24. Updated the read buffer methodes to fit the new core (InputBuffer ->
  25. InputBufferAsString + call to CheckForDataOnSource)
  26. Rev 1.4 2/24/2003 08:33:44 PM JPMugaas
  27. Rev 1.3 1/17/2003 05:35:12 PM JPMugaas
  28. Now compiles with new design.
  29. Rev 1.2 1-1-2003 20:12:56 BGooijen
  30. Changed to support the new TIdContext class
  31. Rev 1.1 12/6/2002 02:35:28 PM JPMugaas
  32. Now compiles with Indy 10.
  33. Rev 1.0 11/14/2002 02:18:08 PM JPMugaas
  34. 2000-Apr-22: J Peter Mugass
  35. Ported to Indy
  36. 1999-Apr-13
  37. Final Version
  38. 2000-JAN-13 MTL
  39. Moved to new Palette Scheme (Winshoes Servers)
  40. }
  41. unit IdDiscardServer;
  42. {
  43. Original Author: Ozz Nixon
  44. }
  45. interface
  46. {$i IdCompilerDefines.inc}
  47. uses
  48. Classes,
  49. IdAssignedNumbers,
  50. IdContext,
  51. IdCustomTCPServer;
  52. Type
  53. TIdDISCARDServer = class ( TIdCustomTCPServer )
  54. protected
  55. function DoExecute(AContext:TIdContext ): Boolean; override;
  56. public
  57. constructor Create(AOwner: TComponent); override;
  58. published
  59. property DefaultPort default IdPORT_DISCARD;
  60. end;
  61. implementation
  62. uses
  63. IdGlobal;
  64. constructor TIdDISCARDServer.Create(AOwner: TComponent);
  65. begin
  66. inherited Create(AOwner);
  67. DefaultPort := IdPORT_DISCARD;
  68. end;
  69. function TIdDISCARDServer.DoExecute(AContext:TIdContext): Boolean;
  70. begin
  71. Result := True;
  72. // Discard it
  73. // TODO: use IOHandler.DiscardAll() instead?
  74. AContext.Connection.IOHandler.CheckForDataOnSource;
  75. AContext.Connection.IOHandler.InputBuffer.Clear;
  76. end;
  77. end.