<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:p="urn:schemas-microsoft-com:office:powerpoint" xmlns:a="urn:schemas-microsoft-com:office:access" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns:b="urn:schemas-microsoft-com:office:publisher" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:odc="urn:schemas-microsoft-com:office:odc" xmlns:oa="urn:schemas-microsoft-com:office:activation" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:q="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rtc="http://microsoft.com/officenet/conferencing" xmlns:D="DAV:" xmlns:Repl="http://schemas.microsoft.com/repl/" xmlns:mt="http://schemas.microsoft.com/sharepoint/soap/meetings/" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ppda="http://www.passport.com/NameSpace.xsd" xmlns:ois="http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:udc="http://schemas.microsoft.com/data/udc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sub="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/" xmlns:ec="http://www.w3.org/2001/04/xmlenc#" xmlns:sp="http://schemas.microsoft.com/sharepoint/" xmlns:sps="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:udcs="http://schemas.microsoft.com/data/udc/soap" xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile" xmlns:udcp2p="http://schemas.microsoft.com/data/udc/parttopart" xmlns:wf="http://schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:dsss="http://schemas.microsoft.com/office/2006/digsig-setup" xmlns:dssi="http://schemas.microsoft.com/office/2006/digsig" xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature" xmlns:mver="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:mrels="http://schemas.openxmlformats.org/package/2006/relationships" xmlns:spwp="http://microsoft.com/sharepoint/webpartpages" xmlns:ex12t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ex12m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:pptsl="http://schemas.microsoft.com/sharepoint/soap/SlideLibrary/" xmlns:spsl="http://microsoft.com/webservices/SharePointPortalServer/PublishedLinksService" xmlns:Z="urn:schemas-microsoft-com:" xmlns:st="" xmlns="http://www.w3.org/TR/REC-html40" xmlns:ns0="urn:schemas-microsoft-com:office:smarttags"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:PMingLiU;
        panose-1:2 2 3 0 0 0 0 0 0 0;}
@font-face
        {font-family:PMingLiU;
        panose-1:2 2 3 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"\@PMingLiU";
        panose-1:2 2 3 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Arial","sans-serif";
        color:#1F497D;
        font-weight:normal;
        font-style:normal;}
span.apple-style-span
        {mso-style-name:apple-style-span;}
span.EmailStyle22
        {mso-style-type:personal;
        font-family:"Arial","sans-serif";
        color:#1F497D;
        font-weight:normal;
        font-style:normal;}
span.EmailStyle23
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle24
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle25
        {mso-style-type:personal;
        font-family:"Arial","sans-serif";
        color:#1F497D;
        font-weight:normal;
        font-style:normal;}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
span.EmailStyle27
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle28
        {mso-style-type:personal;
        font-family:"Arial","sans-serif";
        color:#1F497D;
        font-weight:normal;
        font-style:normal;}
span.EmailStyle29
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-NZ link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>I hope you are right. I’ll check this out and let you know.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>I guess this means the UPnP changes are lost when the router is reset.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Cheers.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> delphi-bounces@listserver.123.net.nz [mailto:delphi-bounces@listserver.123.net.nz] <b>On Behalf Of </b>Stefan Mueller<br><b>Sent:</b> Wednesday, 7 September 2011 5:30 p.m.<br><b>To:</b> 'NZ Borland Developers Group - Delphi List'<br><b>Subject:</b> Re: [DUG] UPnP port forwarding<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'>My router interface actually doesn’t show any upnp forwards .. it shows the usual static port forwarding config screen, but that is configured/managed separately from what is set with upnp.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'>For me, the only way to see upnp forwards is by using the script I emailed before (no need to convert to delphi, just save it as *.vbs script file and run it!). Maybe other routers are better, but mine only has an “upnp enabled” checkbox and that is all there is for managing upnp settings.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'>The only way to test it is by having something listening on the port (accepting incoming connections) and then using a website like </span><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif"'><a href="http://www.canyouseeme.org/">http://www.canyouseeme.org/</a> to check if a connection to that port from external can be made or not (needs to be tested from external, can’t test from within your own network just by using your external wan-address … and don’t forget to configure or switch off your firewall!). <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:navy'><br></span><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'>Kind Regards,<br>Stefan Mueller</span><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#585757'> <br></span><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#666699'>_______________________<br>R&D Manager<br>ORCL Toolbox LLP, </span><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif"'><ns0:place><ns0:country-region><ns0:country-region><ns0:place><span style='color:#666699'>Japan</span></ns0:place></ns0:country-region></ns0:country-region></ns0:place><span style='color:#666699'><br></span><span style='color:blue'><a href="http://www.orcl-toolbox.com/" title="blocked::http://www.orcl-toolbox.com/">http://www.orcl-toolbox.com</a></span><span style='color:#585757'> </span></span><span lang=EN-US style='font-size:10.0pt;color:black'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:navy'> </span><span lang=EN-US style='color:#1F497D'><o:p></o:p></span></p></div><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> delphi-bounces@listserver.123.net.nz [mailto:delphi-bounces@listserver.123.net.nz] <b>On Behalf Of </b>Ross Levis<br><b>Sent:</b> Wednesday, September 07, 2011 1:38 PM<br><b>To:</b> 'NZ Borland Developers Group - Delphi List'<br><b>Subject:</b> Re: [DUG] UPnP port forwarding<o:p></o:p></span></p></div></div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>I am using my IP, in fact using an Indy function to get that automatically, and it is correct.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>I assume the required test to check if it’s worked is to load the router configuration page and see if the added port appears in the list of forwarded ports, and it doesn’t. It’s a Linksys WAG320N.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>I thought of converting the VB code below to see if it is communicating with the router, so I may have to do that.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Ross.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> <a href="mailto:delphi-bounces@listserver.123.net.nz">delphi-bounces@listserver.123.net.nz</a> <a href="mailto:[mailto:delphi-bounces@listserver.123.net.nz]">[mailto:delphi-bounces@listserver.123.net.nz]</a> <b>On Behalf Of </b>Stefan Mueller<br><b>Sent:</b> Wednesday, 7 September 2011 6:11 a.m.<br><b>To:</b> 'NZ Borland Developers Group - Delphi List'<br><b>Subject:</b> Re: [DUG] UPnP port forwarding<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'>Gave it a quick test in delphi …. Your code actually works fine for me. I ran a simple chat server I did a couple of weeks ago (a html websocket server) on my computer and checked with the website at </span><span lang=EN-US><a href="http://www.canyouseeme.org/">http://www.canyouseeme.org/</a> to see if external computers can connect to me.</span><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'>No idea what the problem is on your end, but I think it’s your router, not your code (unless you pass in the wrong ip address, you pass in your local one, right? Like 192.168.1.3 for example?!) …. Or did you forget to configure your firewall (easiest is to just shut it down for testing – if you are behind a NAT router then you don’t really need a firewall so that shouldn’t be a problem to run a couple of tests). … or did you try to open a port that has already static port forwarding in your router to another computer?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'>Did you check your router for open upnp connections? Following script lists them:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'>Set theNatter = CreateObject( "HNetCfg.NATUPnP")<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'>Dim mappingPorts<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'>Set mappingPorts = theNatter.StaticPortMappingCollection<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'>MsgBox("Total number of ports is " & mappingPorts.Count)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'>for each mappingPort in mappingPorts<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'> MsgBox( mappingPort.Description & " " & mappingPort.ExternalPort & " " & mappingPort.Protocol & " " & mappingPort.InternalPort)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'>Next<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'>(save as *.vbs file, run it with cscript.exe)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'>As far as I am concerned that code you wrote works perfectly fine. <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:navy'><br></span><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'>Kind Regards,<br>Stefan Mueller</span><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#585757'> <br></span><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#666699'>_______________________<br>R&D Manager<br>ORCL Toolbox LLP, </span><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif"'><ns0:place><ns0:country-region><ns0:country-region><ns0:place><span style='color:#666699'>Japan</span></ns0:place></ns0:country-region></ns0:country-region></ns0:place><span style='color:#666699'><br></span><span style='color:blue'><a href="http://www.orcl-toolbox.com/" title="blocked::http://www.orcl-toolbox.com/">http://www.orcl-toolbox.com</a></span><span style='color:#585757'> </span></span><span lang=EN-US style='font-size:10.0pt;color:black'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:navy'> </span><span lang=EN-US style='color:#1F497D'><o:p></o:p></span></p></div><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> <a href="mailto:delphi-bounces@listserver.123.net.nz">delphi-bounces@listserver.123.net.nz</a> <a href="mailto:[mailto:delphi-bounces@listserver.123.net.nz]">[mailto:delphi-bounces@listserver.123.net.nz]</a> <b>On Behalf Of </b>Ross Levis<br><b>Sent:</b> Tuesday, September 06, 2011 9:00 PM<br><b>To:</b> 'NZ Borland Developers Group - Delphi List'<br><b>Subject:</b> Re: [DUG] UPnP port forwarding<o:p></o:p></span></p></div></div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>I’ve condensed it to the following function, but it doesn’t work.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>procedure AddNatPortMapping(EntryName: string; Port: Cardinal; IP: string);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>var<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'> NATUPnP, PortMapping: OleVariant;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>begin<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'> NATUPnP := CreateOLEObject('HNetCfg.NATUPnP');<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'> PortMapping := NATUPnP.StaticPortMappingCollection;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'> PortMapping.Add(Port, 'TCP', Port, IP, True, EntryName);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>end;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>I have confirmed that my router does support UPnP and is enabled. Any ideas?<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>But the delphi3000 code to add an application to the firewall does work.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Ross.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Ross Levis <a href="mailto:[mailto:ross@stationplaylist.com]">[mailto:ross@stationplaylist.com]</a> <br><b>Sent:</b> Tuesday, 6 September 2011 10:11 p.m.<br><b>To:</b> 'NZ Borland Developers Group - Delphi List'<br><b>Subject:</b> RE: [DUG] UPnP port forwarding<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>I mistakenly thought the delphi3000 code was related to UPnP but it’s only opening the firewall, which will be necessary also.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>The uPnP component mentioned doesn’t even seem to have HNetCfg mentioned anywhere in the source.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>I have no experience working with OLE objects, assuming that is what HNetCfg.NATUPnP is. I’ll try to translate some VB code from the knoxscape site. Does the following look correct?<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>var<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'> </span><span lang=EN-US>NATUPnP</span><span style='font-size:10.0pt;font-family:Consolas'>, PortMapping: OleVariant;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>begin<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'> </span><span lang=EN-US>NATUPnP</span><span style='font-size:10.0pt;font-family:Consolas'> := CreateOLEObject('</span><span lang=EN-US>HNetCfg.NATUPnP’</span><span style='font-size:10.0pt;font-family:Consolas'>);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'> PortMapping := </span><span lang=EN-US>NATUPnP</span><span style='font-size:10.0pt;font-family:Consolas'>.StaticPortMappingCollection;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>//We add a new port saying that externally accept from port 1024<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>//route to internal port 1024 on computer with IP 192.168.1.101<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>//Enabling the forward, and giving a name of the forward to be IRC<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'> PortMapping.Add(1024, "TCP", 1024, "192.168.1.101", TRUE, "IRC");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>end;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Ross.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> <a href="mailto:delphi-bounces@listserver.123.net.nz">delphi-bounces@listserver.123.net.nz</a> <a href="mailto:[mailto:delphi-bounces@listserver.123.net.nz]">[mailto:delphi-bounces@listserver.123.net.nz]</a> <b>On Behalf Of </b>Stefan Mueller<br><b>Sent:</b> Tuesday, 6 September 2011 2:19 a.m.<br><b>To:</b> 'NZ Borland Developers Group - Delphi List'<br><b>Subject:</b> Re: [DUG] UPnP port forwarding<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'>Also found this one: </span><span lang=EN-US><a href="http://www.whitebear.ch/upnp.htm">http://www.whitebear.ch/upnp.htm</a><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'>.. looks like somebody already made a nice Delphi-upnp component.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>That upnp component looks like a bit of overkill though. Opening an upnp port only requires a simple call to HNetCfg.NATUPnP … and don’t forget, you also still need to open up your windows firewall … doing the upnp part on the router is just half of the job of getting it working for your clients! So, might as well use the HNetCfg com-api as a convenient wrapper that does everything … instead of the Delphi component. <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:navy'><br></span><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'>Regards,<br>Stefan<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:navy'> </span><span lang=EN-US style='color:#1F497D'><o:p></o:p></span></p></div><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> <a href="mailto:delphi-bounces@listserver.123.net.nz">delphi-bounces@listserver.123.net.nz</a> <a href="mailto:[mailto:delphi-bounces@listserver.123.net.nz]">[mailto:delphi-bounces@listserver.123.net.nz]</a> <b>On Behalf Of </b>Stefan Mueller<br><b>Sent:</b> Monday, September 05, 2011 11:05 PM<br><b>To:</b> 'NZ Borland Developers Group - Delphi List'<br><b>Subject:</b> Re: [DUG] UPnP port forwarding<o:p></o:p></span></p></div></div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Here are 3 links that should help:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US><a href="http://www.delphi3000.com/articles/article_5021.asp?SK=">http://www.delphi3000.com/articles/article_5021.asp?SK=</a><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><a href="http://msdn.microsoft.com/en-us/library/aa366415.aspx">http://msdn.microsoft.com/en-us/library/aa366415.aspx</a><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><a href="http://www.knoxscape.com/Upnp/NAT.htm">http://www.knoxscape.com/Upnp/NAT.htm</a><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>the </span><span class=apple-style-span><span lang=EN-US style='font-size:9.0pt;font-family:"Courier New";color:black;background:#EEEECC'>HNetCfg com-api has all the necessary stuff in it to open and query upnp devices. </span></span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><div><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:navy'><br></span><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'>Kind Regards,<br>Stefan Mueller</span><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#585757'> <br></span><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#666699'>_______________________<br>R&D Manager<br>ORCL Toolbox LLP, </span><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif"'><ns0:place><ns0:country-region><ns0:country-region><ns0:place><span style='color:#666699'>Japan</span></ns0:place></ns0:country-region></ns0:country-region></ns0:place><span style='color:#666699'><br></span><span style='color:blue'><a href="http://www.orcl-toolbox.com/" title="blocked::http://www.orcl-toolbox.com/">http://www.orcl-toolbox.com</a></span><span style='color:#585757'> </span></span><span lang=EN-US style='font-size:10.0pt;color:black'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:navy'> </span><span lang=EN-US style='color:#1F497D'><o:p></o:p></span></p></div><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> <a href="mailto:delphi-bounces@listserver.123.net.nz">delphi-bounces@listserver.123.net.nz</a> <a href="mailto:[mailto:delphi-bounces@listserver.123.net.nz]">[mailto:delphi-bounces@listserver.123.net.nz]</a> <b>On Behalf Of </b>Ross Levis<br><b>Sent:</b> Monday, September 05, 2011 7:30 PM<br><b>To:</b> 'NZ Borland Developers Group - Delphi List'<br><b>Subject:</b> [DUG] UPnP port forwarding<o:p></o:p></span></p></div></div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>I’m increasingly being asked for help from my users for configuring port forwarding in their routers. My software has a couple of servers which need to be accessed from the outside world if they wish to use some features.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>I’ve heard UPnP will do this for them, and wondering if there is a simple function someone has written for Delphi (D7) that can check if a specific port number is already being forwarded and if not forward it.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Or otherwise a freeware app which can be run on a workstation to configure any UPnP router.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Cheers,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Ross.<o:p></o:p></span></p></div></body></html>