summaryrefslogtreecommitdiff
path: root/modules/upnp
diff options
context:
space:
mode:
authortree786 <40580296+tree786@users.noreply.github.com>2019-06-19 17:50:53 +0100
committerRĂ©mi Verschelde <rverschelde@gmail.com>2019-06-27 17:17:15 +0200
commit2a63853720df3bacf2081795385d8b95fdfc5913 (patch)
tree5592c1ccacb9eb17d43e351b12e2f1819c92aec5 /modules/upnp
parent538c8eec15d72b67e102f47f9df7624c29d14607 (diff)
doc: UPNP: Add example on how to open/close a port
I have added a small code sample to show how to automate the process of port forwarding (and closing after you are done). Thanks to @mhilbrunner for explaining how to achieve t0his (see #18780)
Diffstat (limited to 'modules/upnp')
-rw-r--r--modules/upnp/doc_classes/UPNP.xml11
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/upnp/doc_classes/UPNP.xml b/modules/upnp/doc_classes/UPNP.xml
index 6530fd614e..d3eb21e159 100644
--- a/modules/upnp/doc_classes/UPNP.xml
+++ b/modules/upnp/doc_classes/UPNP.xml
@@ -5,6 +5,17 @@
</brief_description>
<description>
Provides UPNP functionality to discover [UPNPDevice]s on the local network and execute commands on them, like managing port mappings (port forwarding) and querying the local and remote network IP address. Note that methods on this class are synchronous and block the calling thread.
+ To forward a specific port:
+ [codeblock]
+ const PORT = 7777
+ var upnp = UPNP.new()
+ upnp.discover(2000, 2, "InternetGatewayDevice")
+ upnp.add_port_mapping(port)
+ [/codeblock]
+ To close a specific port (e.g. after you have finished using it):
+ [codeblock]
+ upnp.delete_port_mapping(port)
+ [/codeblock]
</description>
<tutorials>
</tutorials>