NMEcho.pas
资源名称:FastNet.rar [点击查看]
上传用户:szzdds
上传日期:2013-09-18
资源大小:293k
文件大小:2k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit NMEcho;
- {$X+}
- {$R-}
- {$IFDEF VER100}
- {$DEFINE NMF3}
- {$ENDIF}
- {$IFDEF VER110}
- {$DEFINE NMF3}
- {$ENDIF}
- {$IFDEF VER120}
- {$DEFINE NMF3}
- {$ENDIF}
- {$IFDEF VER125}
- {$DEFINE NMF3}
- {$ENDIF}
- interface
- uses
- Classes, SysUtils, Psock, NMConst;
- {$IFDEF VER110}
- {$OBJEXPORTALL On}
- {$ENDIF}
- {$IFDEF VER120}
- {$OBJEXPORTALL On}
- {$ENDIF}
- {$IFDEF VER125}
- {$OBJEXPORTALL On}
- {$ENDIF}
- // CompName='TNMEcho';
- // Major_Version='4';
- // Minor_Version='02';
- // Date_Version='012798';
- type
- TNMEcho = class(TPowerSock)
- private
- FEchoInStr: string;
- FElapsedTime: single;
- protected
- { Protected declarations }
- public
- constructor Create(AOwner: TComponent); override;
- function Echo(EchoString: string): string;
- property ElapsedTime: single read FElapsedTime;
- published
- property OnConnectionRequired;
- end; {_ TNMEcho = class(TPowerSock) _}
- implementation
- constructor TNMEcho.Create(AOwner: TComponent);
- begin
- inherited Create(AOwner);
- FEchoInStr := sEcho_Cons_Msg_echoS;
- Port := 7;
- end; {_ constructor TNMEcho.Create(AOwner: TComponent); _}
- function TNMEcho.Echo(EchoString: string): string;
- var i: TdateTime;
- begin
- if (not (csDesigning in ComponentState)) and (not (CSLoading in ComponentState)) then
- begin
- CertifyConnect;
- i := Now;
- Writeln(EchoString);
- Result := Readln;
- FElapsedTime := 24 * 60 * 60 * 100 * (Now - i);
- end {_ if (not (csDesigning in ComponentState)) and (not (CSLoading in ComponentState)) then _}
- else {_ NOT if (not (csDesigning in ComponentState)) and (not (CSLoading in ComponentState)) then _} Result := '';
- end; {_ function TNMEcho.Echo(EchoString: string): string; _}
- end.