所以这过去可以顺利工作,但现在我收到“Socket Error #10054 Connection reset by peer”。
我认为一旦我更新了我的 Indy 包,它就开始发生了。今天是我从那以后第一次运行代码。
谁能解释更新可能如何改变了这段代码的行为以及如何解决它?
谢谢你
function PostData(url : string; param: TStringList) : string;
var
text: string;
sHttpSocket: TIdHTTP;
sshSocketHandler: TIdSSLIOHandlerSocketOpenSSL;
resStream: TStringStream;
begin
sHttpSocket := TIdHTTP.create;
sshSocketHandler := TIdSSLIOHandlerSocketOpenSSL.create;
sHttpSocket.IOHandler := sshSocketHandler;
sHttpSocket.Request.ContentType := 'application/x-www-form-urlencoded';
sHttpSocket.Request.Method := 'POST';
resStream := TStringStream.create;
sHttpSocket.Post(url, param, resStream);
resStream.Seek(0, soFromBeginning);
text := resStream.DataString;
result := text;
end;