You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently this library seems only to support one port number for both local external. It would be nice to be able to specifiy both an internal and external port.
E.g. I'm running a web server at machine X which should me accessible on outside port 80. Also, I'm running an IOT project which runs on port 80 (local), but should have a different external port.
I'm running a modified version of the TinyUPNP library myself, with a couple of little changes:
TinyUPnP.cpp
line 54 from:
void TinyUPnP::addPortMappingConfig(IPAddress ruleIP, int rulePort, String ruleProtocol, int ruleLeaseDuration, String ruleFriendlyName)
to:
void TinyUPnP::addPortMappingConfig(IPAddress ruleIP, int internalPort, int externalPort, String ruleProtocol, int ruleLeaseDuration, String ruleFriendlyName) {
void addPortMappingConfig(IPAddress ruleIP /* can be NULL */, int rulePort, String ruleProtocol, int ruleLeaseDuration, String ruleFriendlyName);
to:
void addPortMappingConfig(IPAddress ruleIP /* can be NULL */ ,int internalPort, int externalPort, String ruleProtocol, int ruleLeaseDuration, String ruleFriendlyName);
Tested and working on my ESP8266 firmware.
The text was updated successfully, but these errors were encountered:
Made the changes, including function overloading for users with the current library version for compatibility. I'm pretty new to GitHub and don't know how to upload files here, so I've uploaded it to my server:
Currently this library seems only to support one port number for both local external. It would be nice to be able to specifiy both an internal and external port.
E.g. I'm running a web server at machine X which should me accessible on outside port 80. Also, I'm running an IOT project which runs on port 80 (local), but should have a different external port.
I'm running a modified version of the TinyUPNP library myself, with a couple of little changes:
TinyUPnP.cpp
line 54 from:
void TinyUPnP::addPortMappingConfig(IPAddress ruleIP, int rulePort, String ruleProtocol, int ruleLeaseDuration, String ruleFriendlyName)
to:
void TinyUPnP::addPortMappingConfig(IPAddress ruleIP, int internalPort, int externalPort, String ruleProtocol, int ruleLeaseDuration, String ruleFriendlyName) {
line 59 from:
newUpnpRule->internalPort = rulePort;
to:
newUpnpRule->internalPort = internalPort;
line 60 from:
newUpnpRule->externalPort = rulePort;
to
newUpnpRule->externalPort = externalPort;
line 436 from:
sprintf(integer_string, "%d", rule_ptr->internalPort);
to:
sprintf(integer_string, "%d", rule_ptr->externalPort);
line 810 from:
sprintf(integer_string, "%d", rule_ptr->internalPort);
to:
sprintf(integer_string,
"%d",rule_ptr->externalPort);
TinyUPnP.h
line 107 from:
void addPortMappingConfig(IPAddress ruleIP /* can be NULL */, int rulePort, String ruleProtocol, int ruleLeaseDuration, String ruleFriendlyName);
to:
void addPortMappingConfig(IPAddress ruleIP /* can be NULL */ ,int internalPort, int externalPort, String ruleProtocol, int ruleLeaseDuration, String ruleFriendlyName);
Tested and working on my ESP8266 firmware.
The text was updated successfully, but these errors were encountered: