[p2p-hackers] Getting started with UPnP on Win32
David Barrett
dbarrett at quinthar.com
Fri Jul 8 05:17:07 UTC 2005
Ah, I'll answer my own question:
It appears WinXP has another API in the Platform SDK named "Network
Address Translation". It's a wrapper over the UPnP NAT functionality
(thus you don't touch the UPnP API directly). Rather, you use these
basic steps:
1) Create a UPnPNAT COM object and get its IUPnPNAT interface
2) Call IUPnPNAT::get_StaticPortMappingCollection( )
3) IStaticPortMappingCollection::Add( ) to add configure a port forward
At least, that's the theory. A C++ file showing it in action is here:
http://cvs.sourceforge.net/viewcvs.py/dcplusplus/dcplusplus/windows/UPnP.cpp?rev=1.3
Not sure how well the whole thing works and it only appears to work
under XP, but it's a place to start.
-david
David Barrett wrote:
> Can you recommend a good resource for getting started with Universal
> Plug-n-Play on Win32 for NAT traversal purposes?
>
> I see the various UPnP APIs (Control Point, Device Host, etc.) in the
> MSDN docs, but I don't see specific mention of how to apply them to NAT
> configuration. Rather, they seem to give an overall approach for
> configuring an arbitrary UPnP device, with details on specific devices
> left as "an exercise to the reader".
>
> Can you give me the 30-second overview of COM objects and function calls
> I need to use? Or can you refer me to a decent overview of the subject?
> If nothing else, do you know of some sample code that shows
> configuring a NAT device to allow incoming data?
>
> Thanks!
>
> -david
> _______________________________________________
> p2p-hackers mailing list
> p2p-hackers at zgp.org
> http://zgp.org/mailman/listinfo/p2p-hackers
> _______________________________________________
> Here is a web page listing P2P Conferences:
> http://www.neurogrid.net/twiki/bin/view/Main/PeerToPeerConferences
>
>
More information about the P2p-hackers
mailing list