offbynull/portmapper

Error using in Windows. Is this library Unix only?

Closed this issue · 3 comments

Hi,

I was evaluating this library, and while following the example, I got

[Thread-27] INFO com.offbynull.portmapper.mappers.upnpigd.UpnpIgdPortMapper - Attempting to identify devices
[Thread-27] 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 "ifconfig": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at com.offbynull.portmapper.gateways.process.ProcessRunnable.processMessage(ProcessRunnable.java:106)
at com.offbynull.portmapper.gateways.process.ProcessRunnable.run(ProcessRunnable.java:67)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.(ProcessImpl.java:386)
at java.lang.ProcessImpl.start(ProcessImpl.java:137)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 3 more
[Thread-27] 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 "ifconfig": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at com.offbynull.portmapper.gateways.process.ProcessRunnable.processMessage(ProcessRunnable.java:106)
at com.offbynull.portmapper.gateways.process.ProcessRunnable.run(ProcessRunnable.java:67)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.(ProcessImpl.java:386)
at java.lang.ProcessImpl.start(ProcessImpl.java:137)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 3 more

So, this library can't be used on Windows?

Yes it can. The errors your seeing are benign.

The library tries every possible command for every OS. It doesn't check which OS you're using beforehand. So, even if you're running Windows, it will still try to run ifconfig (along with its Windows equivalent).

The reason I did this was because I didn't want to run into a case where the library failed because the OS wasn't properly detected.

See #31

Is what I'm saying making sense?

Closing EOD today if no feedback.

Hi, sorry for the reply. Yes, it makes sense, thank you for explaining.

I'll continue my evaluation then. Thanks again!