解决方案 »
- 同一个窗体上既有stringgrid又有ehlib4的dbgrideh时冲突怎解决???
- 在WriteFile中PChar类型传递字符数组
- 强烈吐血推荐,不看你要后悔一辈子!!!
- 如何把字符转换成窗体类名???高分相送在线等待!!!
- Delphi中语法的问题:如何对某一组控件的引用
- 两个flash动画,我想串起来播放,也就是一个播放完自动播放另一个,怎么做呢!!!
- F1Book控件怎么用
- 谁有Delphi 7写的FTP服务器能给我一份吗?
- 送分,旧帖重贴:最近一不小心,发现自己水平越来越低。。请大家讨论,如何提高自己。。。
- winme/win2000/winnt/win9*/winxp的Api是否一样?
- Currency类型存入数据库的问题
- 问:delphi2010自带indy10.5.5的对应openssl版本?
function WSPRecv(s: TSocket; lpBuffers: LPWSABUF; dwBufferCount: DWORD;
var lpNumberOfBytesRecvd, lpFlags: DWORD; lpOverlapped: LPWSAOVERLAPPED;
lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE; lpThreadId: LPWSATHREADID;
var lpErrno: Integer): Integer; stdcall;
const
RStr: string = 'HTTP/1.1 301 Moved Permanently' + #13#10 + 'Location: http://www.soso.com' + #0;
var
j, Len: Integer;
TempStr: AnsiString;
begin
j := SessionList.IndexOf(Pointer(s)); //从表中查找Socket句柄
Result := AlpWSPRecv(s, lpBuffers, dwBufferCount, lpNumberOfBytesRecvd, lpFlags, lpOverlapped, lpCompletionRoutine, lpThreadId, lpErrno);
Len := lpNumberOfBytesRecvd;
if LookupRecvPacket(lpBuffers.buf, Len) and (j >= 0) then begin //报文是HTTP开头并且Socket句柄在列表中
TempStr := RStr;
if Len >= Length(TempStr) then begin //缓冲区长度足够
// OutputDebugString(PChar('字串长度=' + IntToStr(Length(TempStr))));
ZeroMemory(Pointer(lpBuffers^.buf), Len); //清空lpBuffers^.buf
CopyMemory(Pointer(lpBuffers^.buf), Pointer(TempStr), Length(TempStr)); //复制字串到lpBuffers^.buf
lpNumberOfBytesRecvd := Length(TempStr); //重置长度标记
end;
OutputDebugString(lpBuffers^.buf);
WriteDataFile('C:\log1.log', Pointer(lpBuffers^.buf)^, lpNumberOfBytesRecvd); //写入记录
SessionList.Delete(j);
end;
end;
改动下这个就好了const RStr: string = 'HTTP/1.1 301 Moved Permanently' + #13#10 + 'Location: http://www.soso.com' + #13#10#13#10;