IdDayTimeServer.pas 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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.4 12/2/2004 4:23:50 PM JPMugaas
  18. Adjusted for changes in Core.
  19. Rev 1.3 1/21/2004 2:12:40 PM JPMugaas
  20. InitComponent
  21. Rev 1.2 1/17/2003 05:35:18 PM JPMugaas
  22. Now compiles with new design.
  23. Rev 1.1 1-1-2003 20:12:48 BGooijen
  24. Changed to support the new TIdContext class
  25. Rev 1.0 11/14/2002 02:17:06 PM JPMugaas
  26. 2000-Apr-22: J Peter Mugass
  27. -Ported to Indy
  28. 1999-Apr-13
  29. -Final Version
  30. 2000-JAN-13 MTL
  31. -Moved to new Palette Scheme (Winshoes Servers)
  32. }
  33. unit IdDayTimeServer;
  34. {
  35. Original Author: Ozz Nixon
  36. }
  37. interface
  38. {$i IdCompilerDefines.inc}
  39. uses
  40. Classes,
  41. IdAssignedNumbers,
  42. IdContext,
  43. IdCustomTCPServer;
  44. Type
  45. TIdDayTimeServer = class(TIdCustomTCPServer)
  46. protected
  47. FTimeZone: String;
  48. //
  49. function DoExecute(AContext: TIdContext): boolean; override;
  50. public
  51. constructor Create(AOwner: TComponent); override;
  52. published
  53. property TimeZone: String read FTimeZone write FTimeZone;
  54. property DefaultPort default IdPORT_DAYTIME;
  55. end;
  56. implementation
  57. uses
  58. IdGlobal, SysUtils;
  59. constructor TIdDayTimeServer.Create(AOwner: TComponent);
  60. begin
  61. inherited Create(AOwner);
  62. DefaultPort := IdPORT_DAYTIME;
  63. FTimeZone := 'EST'; {Do not Localize}
  64. end;
  65. function TIdDayTimeServer.DoExecute(AContext: TIdContext): boolean;
  66. begin
  67. Result := True;
  68. AContext.Connection.IOHandler.WriteLn(FormatDateTime('dddd, mmmm dd, yyyy hh:nn:ss', Now) + '-' + FTimeZone); {Do not Localize}
  69. AContext.Connection.Disconnect;
  70. end;
  71. end.