I try to use IPv6 protocol in my mobile program.
My server is located inside the LAN behind NAT.
On the server I use IP port 3000
I have organized Virtual Server / Port Forwarding from my router port 45500 to port 3000 of my server.
On the server, I ran the ipconfig command and got IpV6 address.
Connection-specific DNS Suffix . : IPv6 Address. . . . . . . . . . . : 2a02:2168:xxxxxxx.63b1:6e81:399c Link-local IPv6 Address . . . . . : fe80::7c7b:xxxxxxxx399c%12 IPv4 Address. . . . . . . . . . . : 192.168.1.100 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : fe80::e23fxxxxxxxxxcccc%12 192.168.1.1
Next, I made changes to the connection library kmbmw:
FSocket.Host := FHost;
FSocket.Port := FPort;
...
{$IFDEF KBMMW_USING_INDY_10}
// Changes
//ShowMessage('Indy 10');
FSocket.ReadTimeout:=RequestTimeout*1000;
FSocket.ConnectTimeout:=ConnectTimeout*1000;
if GStack.IsIP(FHost) then // only checks for IPv4 right now
begin
FSocket.IPVersion := Id_IPv4;
FSocket.Connect;
end
else if MakeCanonicalIPv6Address(FHost) <> '' then
begin
FSocket.IPVersion := Id_IPv6;
FSocket.Connect;
end
else
begin
// connecting to a hostname, try IPv6 first, then fallback to IPv4...
try
FSocket.IPVersion := Id_IPv6;
FSocket.Host := '2a02:2168:xxxxxxx.63b1:6e81:399c'; // My IpV6 from ipconfig
FSocket.Port := 3000;
FSocket.Connect;
except
FSocket.IPVersion := Id_IPv4;
FSocket.Host := '95.84.x.x'; // My static ipv4
FSocket.Port := 45500;
FSocket.Connect;
end;
end;
// Changes
{$ENDIF}
Are these the right steps?