IdDiscardServer.pas 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. IdAssignedNumbers,
  49. IdContext,
  50. IdCustomTCPServer;
  51. Type
  52. TIdDISCARDServer = class ( TIdCustomTCPServer )
  53. protected
  54. function DoExecute(AContext:TIdContext ): Boolean; override;
  55. procedure InitComponent; override;
  56. published
  57. property DefaultPort default IdPORT_DISCARD;
  58. end;
  59. implementation
  60. uses
  61. IdGlobal;
  62. procedure TIdDISCARDServer.InitComponent;
  63. begin
  64. inherited InitComponent;
  65. DefaultPort := IdPORT_DISCARD;
  66. end;
  67. function TIdDISCARDServer.DoExecute(AContext:TIdContext): Boolean;
  68. begin
  69. Result := True;
  70. // Discard it
  71. AContext.Connection.IOHandler.CheckForDataOnSource;
  72. AContext.Connection.IOHandler.InputBuffer.Clear;
  73. end;
  74. end.