Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

21
LINES

< > BotCompany Repo | #1024025 // Test WaifUPnP [open port on router]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 10K of libraries. Click here for Pure Java version (4558L/33K).

!7

lib 1400216 import com.dosse.upnp.*;

static int port = 1234;

p {
  serveHttp(port);
  System.out.println("Attempting UPnP port forwarding...");
  if (UPnP.isUPnPAvailable()) {
    if (UPnP.isMappedTCP(port))
      print("UPnP port forwarding not enabled: port is already mapped");
    else if (UPnP.openPortTCP(port))
      print("UPnP port forwarding enabled");
    else
      print("UPnP port forwarding failed");
  } else
    print("UPnP is not available");
}

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: 124 / 479
Version history: 1 change(s)
Referenced in: [show references]