Closed jredfox closed 6 years ago
This error is expected on Windows. It shouldn't hinder any of the functionality provided by the library.
no it's not expected on windows make it more dynamic to get the ip like internet adress.getHostAdress()
Also could you explain the differnce between nat and upnp. If upnp is always enabled on the internet box will it always work even if it supports nat as well?
The commands are run to get the IP address of the gateway. Java doesn't provide you with a way to get gateway addresses -- that's why those commands get run.
It's discussed at https://github.com/offbynull/portmapper#how-does-this-library-discover-nat-pmp-and-pcp-gateway-devices
On Sat, 23 Jun 2018 at 11:10, jredfox notifications@github.com wrote:
no it's not expected on windows make it more dynamic to get the ip like internet adress.getHost
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/offbynull/portmapper/issues/39#issuecomment-399698029, or mute the thread https://github.com/notifications/unsubscribe-auth/AGD4IvvyAlC8cqUeVPBX-tU6bQRcd-JGks5t_oR9gaJpZM4U0WJo .
PCP, NAT-PMP, and UPnP-IGD are different protocols that essentially do this same thing: open up ports to the outside world.
UPnP-IGD is the oldest and most supported, but it's also the most heavy/complicated. NAT-PMP is newer but has since been deprecated in favour of PCP.
Your router may support any of the 3 protocols.
On Sat, 23 Jun 2018 at 11:41, Kasra Faghihi offbynull@gmail.com wrote:
The commands are run to get the IP address of the gateway. Java doesn't provide you with a way to get gateway addresses -- that's why those commands get run.
It's discussed at https://github.com/offbynull/portmapper#how-does-this-library-discover-nat-pmp-and-pcp-gateway-devices
On Sat, 23 Jun 2018 at 11:10, jredfox notifications@github.com wrote:
no it's not expected on windows make it more dynamic to get the ip like internet adress.getHost
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/offbynull/portmapper/issues/39#issuecomment-399698029, or mute the thread https://github.com/notifications/unsubscribe-auth/AGD4IvvyAlC8cqUeVPBX-tU6bQRcd-JGks5t_oR9gaJpZM4U0WJo .
Actually it does look at the source of WaifUPnP which is what I am using now. If you can get your code to be more dynamic getting the data I will use it but, it looks like it's unstable for os
No it doesn't. UPnP does broadcasting to probe for compatible routers/devices. NAT-PMP and PCP require a gateway address, which is usually supplied by the OS.
The UPnP implementation in portmapper uses broadcasting to locate your router. The NAT-PMP/PCP implementation in portmapper uses OS commands to locate your router/gateway.
Last I checked, there was a PCP RFC that provided some form of probing to find the gateway, but it was far from finalized and even when it is finalized there'll be a broad range of existing devices that won't support it. I spent a good chunk of time struggling with this problem when I first implemented portmapper. Unfortunately, there is no elegant solution here. The OS commands are required if you want to use NAT-PMP/PCP. They aren't required if you want to use UPnP.
On Sat, 23 Jun 2018 at 14:56, jredfox notifications@github.com wrote:
Actually it does look at the source of WaifUPnP which is what I am using now.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/offbynull/portmapper/issues/39#issuecomment-399713225, or mute the thread https://github.com/notifications/unsubscribe-auth/AGD4Imj2MFGvkMVzWtmiigUtSCONERgWks5t_rlygaJpZM4U0WJo .
Well look again they dynamically get the gateways of the router and he said it only supports UPNP https://github.com/adolfintel/WaifUPnP/blob/master/src/com/dosse/upnp/GatewayFinder.java
... okay.
On Sat, 23 Jun 2018 at 16:57, jredfox notifications@github.com wrote:
Well look again they dynamically get the gateways of the router and he said it only supports UPNP
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/offbynull/portmapper/issues/39#issuecomment-399718273, or mute the thread https://github.com/notifications/unsubscribe-auth/AGD4IqDU9GF9Q4Yormh8GM5KD1tuaIDTks5t_tXPgaJpZM4U0WJo .
OS:Windows 10 latest Exception: https://pastebin.com/wetU2nCi Code: example from github
It sounds like your not getting the ipv4 dynamically yes there is a way to do this in java it's called public static void main(String[] args) { try { InetAddress i = InetAddress.getLocalHost(); System.out.println(i); // host name and IP address System.out.println(i.getHostName()); // name System.out.println(i.getHostAddress()); // IP address only } catch (Exception e) { e.printStackTrace(); } }