Reputation: 1
We are using RAD Studio 10.0 Seattle to build an iOS App that gets data via web services. Since Apple requires all apps to support IPv6 from 1 Jun 2016, our App update has been rejected.
We are using the WSDL Importer to create the web service class in RAD Studio and then call the web services. When the app connects to an IPv6 network, it throws a Socket Error #51 Network is unreachable...
.
Does anyone know how we could fix this issue?
Upvotes: 0
Views: 1370
Reputation: 1
Using the previous answer I came up with this code, which works for me. I can enter the full soap URL and it returns a correct IPV4 of IPV6 URL. Include 'idURI' in the uses section.
class function TPortalTools.GetRealUrl(Url: string): string;
var
IdURI: TIdURI;
begin
TIdStack.IncUsage;
IdURI := TIdURI.Create(Url);
try
try
GStack.ResolveHost(IdURI.Host, TIdIPVersion.Id_IPv6);
IdURI.IPVersion := TIdIPVersion.Id_IPv6;
except
IdURI.IPVersion := TIdIPVersion.Id_IPv4; // Just in case.
end;
// Put it back together.
Result := IdURI.GetFullURI([]);
finally
FreeAndNil(IdURI);
TIdStack.DecUsage;
end;
end;
Upvotes: 0
Reputation: 1
Try with this func:
function GetHost(Host: String): Boolean;
begin
result := '';
try
GStack.ResolveHost(Host, TIdIPVersion.Id_IPv6);
result := '[' + Host + ']';
except
GStack.ResolveHost(Host, TIdIPVersion.Id_IPv4);
result := Host;
end;
end;
Add in your Uses "IdStack" and "IdGlobal"
you must pass your host (www.google.com for example) and the func return a result with or without '['.
Now, you must just use it... 'http://' + getHost('www.google.com')
if you are in IPV6 network the final string will be (http://[www.google.com])
Upvotes: 0