UPnP, port forward from inside openFrameworks software

Hello, I’m building a software everyone will be able to control in a public space, using websockets and port forward in the router. I have all the proof of concept tested and working.

I’m actually opening the port forward using an OS X software called Port Map here, and it is working OK
https://codingmonkeys.de/portmap/
but after some time (not sure if modem restart or lease time) it disappear.

Anybody knows how to do the same thing directly in c++ / openFrameworks? any addons out there?
cc @arturo
Thank you very much!

i’ve used this addon in the past for opening ports in routers https://github.com/arturoc/ofxNice it uses
the ice protocol which in turn uses another 2 or 3 protocols like stun, turn and upnp to send data accross routers, it should work even with upnp disabled on the router

the api is kind of strange but it’s pretty well documented, the problem is you need to send your data through it, it won’t open a port for you to send through other mediums.

then there’s libupnp (which libnice uses internally if i remember well) https://github.com/mrjimenez/pupnp which is specific to upnp

as you said i think lease time might be the cause and perhaps the easiest is to just check if there’s still connection and if not open the port again