UPnP auto select external port

371 Views Asked by At

I am trying to make an application that utilizes UPnP if necessary to open ports so incoming transmissions can be received. The thing is, I don't want to specify an external port (because one, the external port doesn't matter for the application to be found, and two, I want to make sure multiple people on the same router can use the application, and sharing a port is not an option, obviously). None of the API's I'm looking at says anything about begin able to not specifying a port, but would sending something like 0 or -1 cause it to choose a port itself, or do I have to choose a random number and hope for the best?

Also, will the port mappings ever expire, or do I have to forcefully de-map all of them? I was wondering for in-case the application crashes or the computer looses power or something.

0

There are 0 best solutions below