IdIOHandler.pas 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. { $HDR$}
  2. {**********************************************************************}
  3. { Unit archived using Team Coherence }
  4. { Team Coherence is Copyright 2002 by Quality Software Components }
  5. { }
  6. { For further information / comments, visit our WEB site at }
  7. { http://www.TeamCoherence.com }
  8. {**********************************************************************}
  9. {}
  10. { $Log: 10211: IdIOHandler.pas
  11. {
  12. { Rev 1.1 2003.06.15 3:00:32 PM czhower
  13. { -Fixed IdIOHandlerStream to function as originally designed and needed.
  14. { -Change ReadStream, WriteStream to Input/Output to be consistent with other
  15. { areas.
  16. }
  17. {
  18. { Rev 1.0 2002.11.12 10:42:22 PM czhower
  19. }
  20. unit IdIOHandler;
  21. interface
  22. uses
  23. Classes,
  24. IdComponent, IdGlobal;
  25. type
  26. TIdIOHandler = class(TIdComponent)
  27. protected
  28. FActive: Boolean;
  29. public
  30. procedure AfterAccept; virtual;
  31. procedure Close; virtual;
  32. procedure ConnectClient(const AHost: string; const APort: Integer; const ABoundIP: string;
  33. const ABoundPort: Integer; const ABoundPortMin: Integer; const ABoundPortMax: Integer;
  34. const ATimeout: Integer = IdTimeoutDefault); virtual;
  35. function Connected: Boolean; virtual;
  36. destructor Destroy; override;
  37. procedure Open; virtual;
  38. function Readable(AMSec: Integer = IdTimeoutDefault): Boolean; virtual; abstract;
  39. function Recv(var ABuf; ALen: Integer): Integer; virtual; abstract;
  40. function Send(var ABuf; ALen: Integer): Integer; virtual; abstract;
  41. //
  42. property Active: Boolean read FActive;
  43. end;
  44. implementation
  45. { TIdIOHandler }
  46. procedure TIdIOHandler.Close;
  47. begin
  48. FActive := False;
  49. end;
  50. procedure TIdIOHandler.ConnectClient(const AHost: string;
  51. const APort: Integer; const ABoundIP: string; const ABoundPort,
  52. ABoundPortMin, ABoundPortMax: Integer; const ATimeout: Integer);
  53. begin
  54. //
  55. end;
  56. destructor TIdIOHandler.Destroy;
  57. begin
  58. Close;
  59. inherited;
  60. end;
  61. procedure TIdIOHandler.AfterAccept;
  62. begin
  63. //
  64. end;
  65. procedure TIdIOHandler.Open;
  66. begin
  67. FActive := True;
  68. end;
  69. function TIdIOHandler.Connected: Boolean;
  70. begin
  71. Result := FActive;
  72. end;
  73. end.