Apple App Store要求应用程序仅适用于仅支持ipv6的网络。 如何让IdTelnet在这样的网络上运行?
答案 0 :(得分:4)
TIdTelnet
具有IPVersion
属性,但它被声明为protected
,因此无法通过用户代码直接访问。为了设置IPVersion
,您可以声明一个hack类,例如:
uses
.., IdStack, IdGlobal, ..
type
TIdTelnetHack = class(TIdTelnet)
published
property IPVersion; //expose protected property
end;
procedure TForm1.TelnetConnect(const aHost:String);
var
aIPVersion: TIdIPVersion;
begin
if not IdTelnet1.Connected then
begin //not connected. go connect
// check if ipv6 or ipv4 network, and support both,
try
GStack.ResolveHost(aHost, Id_IPv6);
aIPVersion := Id_IPV6;
except
GStack.ResolveHost(aHost, Id_IPv4);
aIPVersion := Id_IPV4;
end;
IdTelnet1.Host := aHost;
IdTelnet1.Port := 8090;
TIdTelnetHack(IdTelnet1).IPVersion := aIPVersion; //set to IPv4 or IPv6
IdTelnet1.Connect;
end;
end;
要在IPv6网络上测试您的应用,请将Mac设置为IPv6接入点,如下所述: