IdEchoUDPServer.pas 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. IdAssignedNumbers, IdGlobal, IdSocketHandle, IdUDPServer;
  32. type
  33. TIdEchoUDPServer = class(TIdUDPServer)
  34. protected
  35. procedure DoUDPRead(AThread: TIdUDPListenerThread; const AData: TIdBytes; ABinding: TIdSocketHandle); override;
  36. procedure InitComponent; override;
  37. published
  38. property DefaultPort default IdPORT_ECHO;
  39. end;
  40. implementation
  41. { TIdEchoUDPServer }
  42. procedure TIdEchoUDPServer.InitComponent;
  43. begin
  44. inherited InitComponent;
  45. DefaultPort := IdPORT_ECHO;
  46. end;
  47. procedure TIdEchoUDPServer.DoUDPRead(AThread: TIdUDPListenerThread;
  48. const AData: TIdBytes; ABinding: TIdSocketHandle);
  49. begin
  50. inherited DoUDPRead(AThread, AData, ABinding);
  51. ABinding.SendTo(ABinding.PeerIP, ABinding.PeerPort, AData, ABinding.IPVersion);
  52. end;
  53. end.