B4a-Bridge wrong ip (bug)

doomer

Member
Licensed User
Longtime User
Hi i have a HTc one x Android 4.0
i install the new b4a bridge 2.0

When i start it (i wanna conect by wifi i will get the ip 10.012.220.138

while my phone is 10.0.0.250 cant find the problem (displays wrong ip)

is this a bug or a other fault

greets

doomer
 

moster67

Expert
Licensed User
Longtime User
I have had some users reporting a similar issue. I believe it is always with ICS.

They report that my app (which has an info-screen which shows the device's assigned ip-address) returns a private reserved IP-address such as the one doomer is indicating i.e. an ip-address starting with 10.xxx.xxx.xxx while the real actual ip-address is completely different such as 192.168.x.x.

Of course, to obtain the ip-address assigned to the device I use the Networking-library and GetMyIP.

I have been googling around and it seems like other developers have had similar issues. Some resolved it by changing the code used to obtain the ip-address. I cannot find where I read about it in this moment but I believe it was on StackOverflow.

EDIT: I am not 100% sure it is related but it could be. Based upon this thread at StackOverflow:

http://stackoverflow.com/questions/10683495/android-how-to-know-an-ip-address-is-a-wifi-ip-address

it seems like, especially with ICS, that sometimes the IP-address assigned to the device from the 3G-connection remains "in memory" even after the device has obtained a new ip-address from the WIFI-router. This probably means that GetMyIP returns the first IP-address or whichever it finds first. The solution seems to be: is to first detect either one has a mobile network or WiFi connection, and then based on that info get the IP address of that connection.

In this regard, is it already possible in B4A to determine the current connection? If not, maybe it could be done by making a library of the code shown in the 2nd reply in the link I posted above.


Hi i have a HTc one x Android 4.0
i install the new b4a bridge 2.0

When i start it (i wanna conect by wifi i will get the ip 10.012.220.138

while my phone is 10.0.0.250 cant find the problem (displays wrong ip)

is this a bug or a other fault

greets

doomer
 
Last edited:
Upvote 0

stevel05

Expert
Licensed User
Longtime User
I have the same issue on my HTC sensation with ICS , just currently developing via USB.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Yes that works, thanks.
 
Last edited:
Upvote 0

moster67

Expert
Licensed User
Longtime User
Erel,

I am not 100% sure but I do believe some of my users' issue is related as explained in my previous post. In my case, the users cannot resolve it themselves like in the case with B4A-bridge. :(

I don't know how B4A-Bridge works but I guess you use GetMyIP as well and if I am correct, there is probably an issue with GetMyIP and ICS. Shall I open a separate thread?

If I find time this weekend, I will try to use the code mentioned in the SO-thread cited in my previous post or is your GetMyIP-code already similar?


Note that even if the IP address is wrong, you can still use B4A-Bridge and enter the IP address shown in the wifi settings page.
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
Thank you Erel.

I've already added it to the "issues list". GetMyIp returns the first non-local IP (preferring IP4 over IP6).

One option is to return all non-local IPs.
 
Upvote 0

Kevin

Well-Known Member
Licensed User
Longtime User
I've already added it to the "issues list". GetMyIp returns the first non-local IP (preferring IP4 over IP6).

One option is to return all non-local IPs.

This has been a problem for my app... one that I couldn't figure out. My app relys on obtaining the correct IP assigned to the device otherwise one of its main functions does not work. As a work-around I added an option for people to manually enter their IP address but this is obviously not ideal.

Any ETA on the fix, or some sample code for a work-around to obtaining the correct address?
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
I've notices that sometimes once I've started B4a-Bridge it does give an IP address that's not linked to any of my WiFi networks, this happens on all my devices.

All I do is press the home button wait for about 20 seconds, I then go back into B4a-Bridge and bang, WiFi IP address picked up.

Sorted :)

Sent from my A100 using Tapatalk 2
 
Upvote 0

AndyDroid2012

Member
Licensed User
Longtime User
Bridge IP not the browser IP

Hi,
After yesterdays BSOD issues I thought today would be easier....

I downloaded b4a-bridge from Google and run it.

Says IP 192.168.1.65 Waiting for wireless connections

However in android browser google "MY IP" I get the addrs 217.212.230.14

with my desktop Vista m/c "MY IP" i get the addrs 81.131.77.247

From my Vista I can ping 217.212.230.14 OK but 192.168.1.65 ping returns destination unreachable.

Running the b4a IDE I get the same error using the reported IP from the bridge 192.168.1.65.

Peeking in the BTinternet wifi modem as admin I can see
DHCP Table

Device MAC Address IP Address Lease Time
SCOTPC100 00:11:3b:17:bd:01 192.168.1.64 00:00:00:00
Unknown Host 00:92:c3:d6:d2:d0 192.168.1.65 00:23:15:39


so I guess my question is why does the browser think the IP is

217.212.230.14 and is pingable but
the modem seems to have two co-adjacent IPs but is not pingable ?

Attempting to use 217.212.230.14 as the IP in the IDE also fails.

Checking the setup of the modem against BT help pages shows no obvious problem and my android works
fine with http and ftp so I have no reason to think android is wrong but I wish I could change the
b4a-bridge IP to the same as that reported by the browser.

:) ????
--------------------------------------
This was meant to be easy
 
Upvote 0
Top