Download Jar. Uses 10K of libraries. Click here for Pure Java version (4558L/33K).
1 | !7 |
2 | |
3 | lib 1400216 import com.dosse.upnp.*; |
4 | |
5 | static int port = 1234; |
6 | |
7 | p { |
8 | serveHttp(port); |
9 | System.out.println("Attempting UPnP port forwarding..."); |
10 | if (UPnP.isUPnPAvailable()) { |
11 | if (UPnP.isMappedTCP(port)) |
12 | print("UPnP port forwarding not enabled: port is already mapped"); |
13 | else if (UPnP.openPortTCP(port)) |
14 | print("UPnP port forwarding enabled"); |
15 | else |
16 | print("UPnP port forwarding failed"); |
17 | } else |
18 | print("UPnP is not available"); |
19 | } |
20 | |
21 | html { ret "It works brah!!"; } |
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1024025 |
Snippet name: | Test WaifUPnP [open port on router] |
Eternal ID of this version: | #1024025/2 |
Text MD5: | 6145bb4693cb02ad2fe1f9516e553dbc |
Transpilation MD5: | d00ade1e33c63a8f4a3e005accee3439 |
Author: | stefan |
Category: | javax / networking |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-07-17 14:08:47 |
Source code size: | 521 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 302 / 853 |
Version history: | 1 change(s) |
Referenced in: | [show references] |