You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
406 B

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #include "upnpnat.h"
  2. int main(int argc, char * argv[])
  3. {
  4. UPNPNAT nat;
  5. nat.init(5, 10);
  6. if (! nat.discovery())
  7. {
  8. printf("discovery error is %s\n", nat.get_last_error());
  9. return -1;
  10. }
  11. if (! nat.add_port_mapping("test", "192.168.12.117", 1234, 1234, "TCP"))
  12. {
  13. printf("add_port_mapping error is %s\n", nat.get_last_error());
  14. return -1;
  15. }
  16. printf("add port mapping succ.\n");
  17. return 0;
  18. }