adolfintel / WaifUPnP

UPnP Port Forwarding for Java couldn't get any easier!
http://fdossena.com/?p=waifupnp/index.frag
96 stars 27 forks source link

Help Port Doesn't Forward #1

Closed jredfox closed 6 years ago

jredfox commented 6 years ago

so I love the idea of one line but, it appears it's not working for me. I believe UPNP is enabled on my internet box and utorrent does port forward but, I am trying to make a safe program to do so.

The code prints port did open and upnp is available also says true in the loop: Issue http://www.canyouseeme.org can't find port open for 25565. I also tried udp same result Maybe I need to config your program to port my public ip instead of my private ip????

I also read that your only looking for a default gateway my internet is xfiniti maybe you could add an option to scan for all gateways? All I need is a port to open

Code: https://pastebin.com/0uS4guVE

Output: port opened:true mapping:true true

adolfintel commented 6 years ago

I'm not sure about xfiniti, do they put you behind a NAT? In that case, UPnP won't be of much help

jredfox commented 6 years ago

not 100% sure but, UPNP is enabled. Why don't you support NAT with UPNP? Meaning get my public Ip and port forward from that

adolfintel commented 6 years ago

Can you open ports manually from your router?

jredfox commented 6 years ago

yes but, the point of upnp is automatic and only open when needed. So do you try to port forward my ipv4? You should try public ip?

adolfintel commented 6 years ago

Yes of course, I'm asking because if you can open a port manually, and the port is connectable from the outside, then you're not behind a NAT

adolfintel commented 6 years ago

Either way, I can't think of much that could cause this problem. I've been using this in my projects for years without problems

jredfox commented 6 years ago

I can check the configurations in 2 hours but, I think both might be supported. You didn't answer me do you try and port forward private or public ip? not sure how it all works just throwing out an idea of why it could be failing????

adolfintel commented 6 years ago

What do you mean with your private ip? You mean your machine's IP inside the local network?

jredfox commented 6 years ago

ipv4 on windows ipconfig

adolfintel commented 6 years ago

Does your private IP look like 192.168.something?

jredfox commented 6 years ago

to be clear if I use the unsafe program Utorrent/BitTorrent it works every time

adolfintel commented 6 years ago

You could do a network capture and see if your router doesn't like the request from this library. You'd be the first, but it could be

jredfox commented 6 years ago

10.1.10 something public ip I can give you fully:73.51.103.252

What if I edited the method for when it grabs the ip where is it located at I could hard code my public ip and see if it works for a test

adolfintel commented 6 years ago

Ok, 10.anything is a private address, that is your address inside your networks. WaifUPnP will try to tell the router to forward connections to 73.51.103.252:25565 to the machine 10.1.10.x:25565

jredfox commented 6 years ago

ok so is there something wrong with my code then? I used a while loop when checking the port so the app was still running.

I also couldn't figure out where nbproject was suppose to go

Do me a favor and see if canyouseeme.org opens for you with the port success with my code on your end

adolfintel commented 6 years ago

No, your code looks correct. As I said, you should do a network capture and see if your router is refusing the request or something.

jredfox commented 6 years ago

Ok how do I do that?

Also if my router is using NAT does that mean your program won't work? Can you make it work? If not do you know of a java library that can make it work?

adolfintel commented 6 years ago

If your machine is behind a NAT, it's fine, that's the whole point of port forwarding; if your router is behind a NAT (uncommon but not unheard of), I don't think this library can be of much help. Cling might be able to do it, but it's a lot more complicated to use than my library.

jredfox commented 6 years ago

Yeah I setup cling and there were compile errors everywhere and it doesn't give the libraries to use. So I could never test the method I saw online here: https://stackoverflow.com/questions/15324689/router-port-forwarding-using-cling Also this plain out didn't work: https://github.com/bitletorg/weupnp Java port map was a virus had to reset internet box settings Utorrent works but, it's not safe to use and I want to apply code to mc eventually and also a java app Offbynull is too hard coded doesn't work(looks for files specific os on your device) https://github.com/offbynull/portmapper

So your the last option except for cling which has errors and I am unable to find out how to install it. Maybe you could look at this issue a little more and tell me how to do the network capture

adolfintel commented 6 years ago

Yea I know Cling is a pain in the ass. I was able to find binaries for it the one time I used it on the repos used by eclipse

adolfintel commented 6 years ago

To do the network capture you need to use wireshark. Close all applications using the network, start the capture, run the program, stop the capture and see what's going on.

jredfox commented 6 years ago

Ok I will try to do this later will let you know:

Do you still have the test you used for cling maybe I could just dl that and then change the code a bit to use the example I found: https://stackoverflow.com/questions/15324689/router-port-forwarding-using-cling

adolfintel commented 6 years ago

Yes, here's the one time I used Cling https://github.com/adolfintel/voicechat/blob/master/VoiceChat_Server/src/Server.java

It's very old though, I did this in 2012

jredfox commented 6 years ago

ok couple things: I do see a port mapping on my xfiniti for your program just that it must be not properly pushed or something since canyouseeme.org cannot find my port open with 25565 So I debuged removed it again started it nothing. Then I tested ruining the program minecraft open to lan open port it didn't work so I opened up both ports at the same time then it seemed to have worked. Is this a bug sometimes one or the other doesn't work but, If I do both always works maybe something with your implementation of upnp on your side?

cling doesn't compile due to it only being android meaning I can't do crap with their crappy program Anyways I am about to give up soon and try and re-create bit torrent port forwarding forwarding