Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8899243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:48:46+00:00 2026-06-15T00:48:46+00:00

Disclaimer : I’ve carefully read every similar topic here and did a google search.

  • 0

Disclaimer:
I’ve carefully read every similar topic here and did a google search. Non of those answered my questions, so I would like to accumulate information in this topic.
P.S. I might not be so good in English, sorry about that.

I want to make a p2p application (a game). Obviously lots of people will run this program on a machine which is a part of a local network with one internet access point (router) and app simply will not work without port forwarding. So, I did a research and found out that I can do automatic port forwarding with UPnP. Micro test-code were written to access port forwarding:

bool CPortController::Init() {


  HRESULT result = CoInitialize(NULL); // Must be NULL
  if (FAILED(result)) return false;

  result = CoCreateInstance(__uuidof(UPnPNAT), NULL, CLSCTX_ALL, __uuidof(IUPnPNAT), (void **)&Nat);
  if (FAILED(result) || !Nat) return false;

  result = Nat->get_StaticPortMappingCollection(&Collection); 
  if (FAILED(result) || !Collection) return false; // Here I'm getting S_OK as result, but Collection is always == 0

  return true;
}

Searched for reason of that(see comment in code) happening I’ve found:
1. Old system (nope, I have Win7 with updates)
2. Router might not have UPnP capability or it might not be enabled
3. Firewall might be blocking TCP port 2869 or UDP port 1900 which are both needed for UPnP

Sadly, I don’t have access to router to check last 2, but it’s not that important since Skype and uTorrent (both p2p) works perfectly. I need to find the way to do the same trick and forward port automatically with my app without asking user to do anything.

About UPnP libraries:
I’ve found few UPnP libraries (PlatinumUPnP, miniUPnP), but they seems to have so much code oriented on finding smart devices and putting them together … uhm … I’m not sure I need this to complete my task and I can’t find a piece of code (which not using those WinUPnPAPI, I listed above) for auto-port-forwarding.

I’m a bit lost now. Could anyone show me a direction to continue research ? Maybe there is something else than UPnP for that ? Maybe there is a lib (which I missed) to use ? Spread some light, please. Thank you in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T00:48:48+00:00Added an answer on June 15, 2026 at 12:48 am

    Run DeviceSpy from UPnP Developer Tools and search your network for InternetGatewayDevice. If there is none, your router is not UPnP capable or has it disabled. If there is one, check WANIPConnection service. Be aware that as of InternetGatewayDevice v2 (since 2010), you are not allowed to set static port mapping (lease time 0) over UPnP.

    As @Rook pointed out, there are other methods for establishing P2P connections, so the fact that some other random P2P software works, doesn’t necessarily mean that the software knows how to configure your port mapping. Skype in particular is not really P2P, it depends on huge number of dedicated supernodes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Disclaimer: Yes I did lots of searching. Yes I read the forums. Yes I
Disclaimer: I've looked through all the questions I can find and none of them
Disclaimer: I'm not a real developer, so I've probably got some code spaghetti here...
Disclaimer: Yes, I've googled and read through the top six or so hits, searched
Disclaimer: I know this type of question has been asked here before, I just
Disclaimer: I'm sure this has been answered before but I cannot find anything on
Disclaimer This question is a repost. I originally asked it here . While there
Disclaimer: not sure this is WordPress related or not. I'm following a simple tutorial
Disclaimer: I know there are better ways to track email open rates, which are
Disclaimer: I'm a rails n00b. I'm playing around with a simple helper function that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.