// used with "hole punching" NAT traversal technique
procedure TBattleForm.PunchThroughNAT;
var
i: Integer;
begin
for i := 1 {skip the host} to BattleState.Battle.Clients.Count-1 do
try
if TClient(BattleState.Battle.Clients[i]).IP = '' then MainForm.AddMainLog('Error punching through NAT: player''s IP is unknown!', Colors.Error)
else Misc.SendUDPStrEx(TClient(BattleState.Battle.Clients[i]).IP, TClient(BattleState.Battle.Clients[i]).PublicPort, NATTraversal.MyPrivateUDPSourcePort, 2, 'HELLO'); // what we send doesn't really matter (we can send an empty packet as well).
except
MainForm.AddMainLog('Error while sending UDP packet to ' + TClient(BattleState.Battle.Clients[i]).Name + ' (IP=' + TClient(BattleState.Battle.Clients[i]).IP + ')', Colors.Error);
end;
end;