public class Test {
public static void main(String[] args) throws InterruptedException {
// Start gateways
Gateway network = NetworkGateway.create();
Gateway process = ProcessGateway.create();
Bus networkBus = network.getBus();
Bus processBus = process.getBus();
// Discover port forwarding devices and take the first one found
List<PortMapper> mappers = PortMapperFactory.discover(networkBus, processBus);
PortMapper mapper = mappers.get(0);
System.out.println(mapper.getSourceAddress().toString());
}
}
[main] INFO com.offbynull.portmapper.mappers.upnpigd.UpnpIgdPortMapper - Attempting to identify devices
[main] INFO com.offbynull.portmapper.mappers.natpmp.NatPmpPortMapper - Attempting to identify devices
[Process IO] ERROR com.offbynull.portmapper.gateways.process.ProcessRunnable - Unable to create process
java.io.IOException: Cannot run program "ipconfig": error=2, No such file or directory
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
at com.offbynull.portmapper.gateways.process.ProcessRunnable.processMessage(ProcessRunnable.java:106)
at com.offbynull.portmapper.gateways.process.ProcessRunnable.run(ProcessRunnable.java:67)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.io.IOException: error=2, No such file or directory
at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
at java.base/java.lang.ProcessImpl.(ProcessImpl.java:340)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
... 4 more
Caused by: java.io.IOException: error=2, No such file or directory
[main] INFO com.offbynull.portmapper.mappers.pcp.PcpPortMapper - Attempting to identify devices
[Process IO] ERROR com.offbynull.portmapper.gateways.process.ProcessRunnable - Unable to create process
java.io.IOException: Cannot run program "ipconfig": error=2, No such file or directory
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
at com.offbynull.portmapper.gateways.process.ProcessRunnable.processMessage(ProcessRunnable.java:106)
at com.offbynull.portmapper.gateways.process.ProcessRunnable.run(ProcessRunnable.java:67)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.io.IOException: error=2, No such file or directory
at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
at java.base/java.lang.ProcessImpl.(ProcessImpl.java:340)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
... 4 more
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.base/java.util.LinkedList.checkElementIndex(LinkedList.java:559)
at java.base/java.util.LinkedList.get(LinkedList.java:480)
at upnp.Test.main(Test.java:22)
public class Test { public static void main(String[] args) throws InterruptedException { // Start gateways Gateway network = NetworkGateway.create(); Gateway process = ProcessGateway.create(); Bus networkBus = network.getBus(); Bus processBus = process.getBus();
}
[main] INFO com.offbynull.portmapper.mappers.upnpigd.UpnpIgdPortMapper - Attempting to identify devices [main] INFO com.offbynull.portmapper.mappers.natpmp.NatPmpPortMapper - Attempting to identify devices [Process IO] ERROR com.offbynull.portmapper.gateways.process.ProcessRunnable - Unable to create process java.io.IOException: Cannot run program "ipconfig": error=2, No such file or directory at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128) at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071) at com.offbynull.portmapper.gateways.process.ProcessRunnable.processMessage(ProcessRunnable.java:106) at com.offbynull.portmapper.gateways.process.ProcessRunnable.run(ProcessRunnable.java:67) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: java.io.IOException: error=2, No such file or directory at java.base/java.lang.ProcessImpl.forkAndExec(Native Method) at java.base/java.lang.ProcessImpl.(ProcessImpl.java:340)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
... 4 more
Caused by: java.io.IOException: error=2, No such file or directory
[main] INFO com.offbynull.portmapper.mappers.pcp.PcpPortMapper - Attempting to identify devices [Process IO] ERROR com.offbynull.portmapper.gateways.process.ProcessRunnable - Unable to create process java.io.IOException: Cannot run program "ipconfig": error=2, No such file or directory at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128) at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071) at com.offbynull.portmapper.gateways.process.ProcessRunnable.processMessage(ProcessRunnable.java:106) at com.offbynull.portmapper.gateways.process.ProcessRunnable.run(ProcessRunnable.java:67) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: java.io.IOException: error=2, No such file or directory at java.base/java.lang.ProcessImpl.forkAndExec(Native Method) at java.base/java.lang.ProcessImpl.(ProcessImpl.java:340)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
... 4 more
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.base/java.util.LinkedList.checkElementIndex(LinkedList.java:559)
at java.base/java.util.LinkedList.get(LinkedList.java:480)
at upnp.Test.main(Test.java:22)