Android Question Ipv6 Local Link adresses don't work with OKHttpUtils2

fs007

Member
Why does this code not work ?
B4X:
Dim job As HttpJob

job.Initialize("jobname", Me)
job.Download("http://[fe80::92A3:DAFF:FE55:EEF1%wlan0]:1113/xyz.htm")
....

The code throws this error:
B4X:
Invalid link: http://[fe80::92A3:DAFF:FE55:EEF1%wlan0]:1113/xyz.htm
ResponseError. Reason: java.net.UnknownHostException: Unable to resolve host "invalid-url": No address associated with hostname, Response:

Without %wlan0 i get:
B4X:
ResponseError. Reason: java.net.ConnectException: Failed to connect to /[fe80::92a3:daff:fe55:eef1]:1113, Response:

btw: Code works flawless, if i put the global prefix instead of fe80:
 

aeric

Expert
Licensed User
Longtime User
Can you open the link on web browser?
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Use the IPv6 that starts with 2001
or
remove the values after %
e.g http://[fe80::14d4:672d:cef7:cd4]:8080/login

1768612863099.png
 
Last edited:
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
why not go with what works (ie, the global address)? you don't say, but the server may not be on the same network segment, or it may not be listening on the link-local address.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
What is global address or prefix?
 
Upvote 0

fs007

Member
Can you open the link on web browser?
NO ! Using chrome browser on the smartphone throws an error.
Using chrome browser on PC (same subnet, etc.) works !
Maybe this is an issue with Android.

Use the IPv6 that starts with 2001
or
remove the values after %
e.g http://[fe80::14d4:672d:cef7:cd4]:8080/login
that does not work, which is not surprising: routers usually block incoming access from web over ipv6

why not go with what works (ie, the global address)? you don't say, but the server may not be on the same network segment, or it may not be listening on the link-local address.
1. I don't want the device to be exposed to the whole world.
2. Server is on the same network segment and listens to link local address. Otherwise access via PC would not work.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
I can get B4A app download the page using the IPv6 starts with 2001 and OkHttpUtils2.
On PC, Chrome works for IPv6 starts with 2001 and fe80 without the ending %6.
 
Upvote 0

fs007

Member
I can get B4A app download the page using the IPv6 starts with 2001 and OkHttpUtils2.
On PC, Chrome works for IPv6 starts with 2001 and fe80 without the ending %6.
Yes, me too. As i wrote in my first post, code works fine with global prefixes.

I can get B4A app download the page using the IPv6 starts with 2001 and OkHttpUtils2.
On PC, Chrome works for IPv6 starts with 2001 and fe80 without the ending %6.
Yes, me too. As i wrote in my post #8. On Windows, link loal adresses work as they should.

I'll add, that I don't think that OkHttp does anything with the host address. It is the OS API that actually resolves it.
That's probably true, since even chrome browser on android doesn't work with link local adress (with %wlan0 or without).
So the question remains: How to write a link local address so that Android OS accepts it ? Probably i will have to ask google (whether they answer me, is another thing ...)

Still i refuse to believe, that Android OS cannot handle link local IPv6 addresses. IPv6 is nothing new
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
1. I don't want the device to be exposed to the whole world.
I don't understand your statement here.
Isn't your WLAN protected by password such as WPA2?
How the world access your device with the IPv6?
IPv6 doesn't mean Public IP.
 
Upvote 0

Similar Threads

Top