Hola,
He leído en algunas páginas, por Internet, que utilizando upnp es posible añadir un registro a la tabla de nat del router, de tal forma que un programa que contenga un servidor tcp pueda "escuchar" de forma transparente, sin que el usuario tenga que configurar el router o firewall.
Incluso he encontrado este código:
Código Delphi
[-]
Procedure AddUPnPEntry( Port : Integer; const Name : ShortString);
Var
Nat : Variant;
Ports : Variant;
Begin
if NOT (LAN_IP = '127.0.0.1') then
begin
try
Nat := CreateOleObject('HNetCfg.NATUPnP');
Ports := Nat.StaticPortMappingCollection;
showMessage(inttostr(Ports.count));
Ports.Add(port, 'TCP', port, LAN_IP, True, name);
except
ShowMessage(
'An Error occured with adding UPnP Ports. The ' + name +
' port was not added to the router. Please check to see if your ' +
'router supports UPnP and has it enabled or disable UPnP.'
);
end;
end;
End;
pero no consigo que funcione.
¿Alguén sabe algo sobre este tema?
Muchas gracias.
Un Saludo.