gpt4 book ai didi

Delphi - 如何设置SoapClient超时?

转载 作者:行者123 更新时间:2023-12-03 15:52:16 40 4
gpt4 key购买 nike

我在发帖之前这样做:

FTimeout := 30000;

InternetSetOption(Pointer(@Data), INTERNET_OPTION_CONNECT_TIMEOUT, Pointer(@FTimeOut), SizeOf(FTimeOut));
InternetSetOption(Pointer(@Data), INTERNET_OPTION_SEND_TIMEOUT, Pointer(@FTimeOut), SizeOf(FTimeOut));
InternetSetOption(Pointer(@Data), INTERNET_OPTION_RECEIVE_TIMEOUT, Pointer(@FTimeOut), SizeOf(FTimeOut));

但是不起作用。

有人可以帮忙吗?

最佳答案

这应该有效。你没有说你从哪里调用它,但我在 OnBeforePost 处理程序中调用我的。

我的函数如下所示:

function SetTimeout(const HTTPReqResp: THTTPReqResp; Data: Pointer; NumSecs : integer) : boolean;
var
TimeOut: Integer;
begin
// Sets the receive timeout. i.e. how long to wait to 'receive' the response
TimeOut := (NumSecs * 1000);
try
InternetSetOption(Data, INTERNET_OPTION_RECEIVE_TIMEOUT, Pointer(@TimeOut), SizeOf(TimeOut));
InternetSetOption(Data, INTERNET_OPTION_SEND_TIMEOUT, Pointer(@TimeOut), SizeOf(TimeOut));
except on E:Exception do
raise Exception.Create(Format('Unhandled Exception:[%s] while setting timeout to [%d] - ',[E.ClassName, TimeOut, e.Message]));
end;
end;

关于Delphi - 如何设置SoapClient超时?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22872587/

40 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com