function CheckInternet(Url: Pchar;Port: Pchar): Boolean;//Url可以为IP地址
var
HttpStr: string;
begin
if Pos('HTTP',UpperCase(Url)) = 0 then
begin
HttpStr := 'http://';
end;
if Trim(Port) <> '' then
begin
HttpStr := Trim(HttpStr) + Url + ':' + Port;
end
else
begin
HttpStr := Trim(HttpStr) + Url;
end;
if not InternetCheckConnection(Pchar(HttpStr),1,0) then
begin
Result := False; //端口未开
end
else
begin
Result := True; //端口打开
end;
end;