我需要检查一些端口是否可用?如何在 Inno Setup 中做到这一点?
有没有办法在 Inno Setup 中使用套接字?有没有这方面的图书馆?如果有如何导入并使用它?
谢谢您的回答。
最佳答案
您可以使用我的函数来检查端口是否可用:
function CheckPortOccupied(Port:String):Boolean;
var
ResultCode: Integer;
begin
Exec(ExpandConstant('{cmd}'), '/C netstat -na | findstr'+' /C:":'+Port+' "', '', 0,
ewWaitUntilTerminated, ResultCode);
if ResultCode <> 1 then
begin
Log('this port('+Port+') is occupied');
Result := True;
end
else
begin
Result := False;
end;
end;
关于inno-setup - 如何在 Inno Setup 中检查端口是否可用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21701847/