I am making a Python application that requires the user to have a port forwarded to his computer in order to communicate with a server or another user. The current implementation works quite great, yet the only thing is that the person who's running the file must forward the port to the local IP manually. I want to automate this. He picks a port, script checks if it can be forwarded, then it forwards it. If it can't, it handles the error respectively.
I've looked into some libraries that claim they can do this in pure Python (since I will need to compile to .exe's [...] after finishing) but didn't manage to find something useful. If you could provide me with a code sample on how to attempt to forward a port and handle success/fail respectively, that would be great.
Thanks in advance for your time.
P.S.:It's Python 2.7.X that I am targeting