IdUnixTimeUDPServer.pas 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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.0 2/10/2005 2:26:38 PM JPMugaas
  18. New UnixTime Service (port 519) components.
  19. }
  20. unit IdUnixTimeUDPServer;
  21. interface
  22. {$i IdCompilerDefines.inc}
  23. uses
  24. Classes,
  25. IdAssignedNumbers, IdUDPServer, IdTimeUDPServer;
  26. {
  27. This is based on a description at
  28. http://amo.net/AtomicTimeZone/help/ATZS_Protocols.htm#Unix
  29. UnixTime and UnixTime Protocol
  30. Unix is an operating system developed in 1969 by Ken Thompson.
  31. UnixTime counts "epochs" or seconds since the Year 1970. UnixTime
  32. recently hit it's billionth birthday.
  33. Because Unix is widely used in many environments, UnixTime was developed
  34. into a loose simple time protocol in the late 80's and early 90's. No
  35. formal UnixTime protocol has ever been officially published as an internet
  36. protocol - until now.
  37. UnixTime operates on the same UnixTime port - 519. Once a connection is
  38. requested on this port, exactly like in Time Protocol, the UnixTime value
  39. is sent back by either tcp/ip or udp/ip. When UDP/IP is used, a small packet
  40. of data must be received by the server in order to respond in the exact same
  41. fashion as Time Protocol. The UnixTime is then sent as an unsigned
  42. "unformatted" integer on the same port.
  43. }
  44. type
  45. TIdUnixTimeUDPServer = class(TIdCustomTimeUDPServer)
  46. public
  47. constructor Create(AOwner: TComponent); override;
  48. published
  49. property DefaultPort default IdPORT_utime;
  50. end;
  51. implementation
  52. uses
  53. IdGlobalProtocols;
  54. { TIdUnixTimeUDPServer }
  55. constructor TIdUnixTimeUDPServer.Create(AOwner: TComponent);
  56. begin
  57. inherited Create(AOwner);
  58. DefaultPort := IdPORT_utime;
  59. FBaseDate := UNIXSTARTDATE;
  60. end;
  61. end.