文件名称:断点续传示例源码整理
文件大小:194KB
文件格式:RAR
更新时间:2009-03-15 02:52:39
控件 源码 网络通信类 资源
{接收一行数据 Socket,超时,结束符}function SocketRevLine(Socket: TCustomWinSocket; TimeOut: Integer; EndStr: string = #13#10): string;var bufInfo: TBufChar; i: Integer; strStream: TStringStream; {保存所有的数据} FSocketStream: TWinSocketStream;begin strStream := TStringStream.Create(‘‘); FSocketStream := TWinSocketStream.Create(Socket, TimeOut); while Socket.Connected do begin {确定接收的超时,可见WaitForData的源码} if not FSocketStream.WaitForData(TimeOut) then Break; ZeroMemory(@bufInfo, SizeOf(bufInfo)); {每次只读一个字符,以免读入了命令外的数据} i := FsocketStream.Read(bufInfo, 1); if i = 0 then Break; strStream.Write(bufInfo, i); if pos(EndStr, strStream.DataString) <> 0 then Break; end; Result := strStream.DataString; {没有读到回车换行符,就表示有超时错,这时返回空字符串} if Pos(EndStr, Result) = 0 then Result := ‘‘; strStream.Free; FSocketStream.Free;end;
【文件预览】:
BreakPoint
----BreakPoint.exe(438KB)
----BreakPoint.ico(2KB)
----deltemp.bat(90B)
----uBreakPoint.dcu(15KB)
----uBreakPoint.dfm(3KB)
----Config.ini(40B)
----BreakPoint.res(2KB)
----源码说明.txt(1KB)
----uBreakPoint.pas(11KB)