IdEchoUDPServer.pas 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 2004.02.03 5:45:08 PM czhower
  18. Name changes
  19. Rev 1.3 1/22/2004 7:10:04 AM JPMugaas
  20. Tried to fix AnsiSameText depreciation.
  21. Rev 1.2 1/21/2004 3:27:52 PM JPMugaas
  22. InitComponent
  23. Rev 1.1 10/23/2003 03:50:52 AM JPMugaas
  24. TIdEchoUDP Ported.
  25. Rev 1.0 11/14/2002 02:19:38 PM JPMugaas
  26. }
  27. unit IdEchoUDPServer;
  28. interface
  29. {$i IdCompilerDefines.inc}
  30. uses
  31. Classes, IdAssignedNumbers, IdGlobal, IdSocketHandle IdUDPServer;
  32. type
  33. TIdEchoUDPServer = class(TIdUDPServer)
  34. protected
  35. procedure DoUDPRead(AThread: TIdUDPListenerThread; const AData: TIdBytes; ABinding: TIdSocketHandle); override;
  36. public
  37. constructor Create(AOwner: TComponent); override;
  38. published
  39. property DefaultPort default IdPORT_ECHO;
  40. end;
  41. implementation
  42. { TIdEchoUDPServer }
  43. constructor TIdEchoUDPServer.Create(AOwner: TComponent);
  44. begin
  45. inherited Create(AOwner);
  46. DefaultPort := IdPORT_ECHO;
  47. end;
  48. procedure TIdEchoUDPServer.DoUDPRead(AThread: TIdUDPListenerThread;
  49. const AData: TIdBytes; ABinding: TIdSocketHandle);
  50. begin
  51. inherited DoUDPRead(AThread, AData, ABinding);
  52. ABinding.SendTo(ABinding.PeerIP, ABinding.PeerPort, AData, ABinding.IPVersion);
  53. end;
  54. end.