knutf Active Member Licensed User Longtime User Feb 25, 2020 #1 I use HttpJob to download map image from WMS-server. The HttpJob reported this error message: java.net.SocketException: Address family not supported by protocol family: connect. I found that it could be Java that tries to use IPv6 addressing against a server that use IPv4 addressing, and that it could help setting the system property “java.net.preferIPv4Stack” to true. I added the following line: B4X: SetSystemProperty("java.net.preferIPv4Stack" , "true") in the AppStart Sub. It works in Release mode, but not in debug mode. How can i set the system property java.net.preferIPv4Stack so it works in debug mode? I use jdk1.8.0_231 Example project attached. Running in Debug causes the error, but running in Release do not. Attachments WMS kart.zip WMS kart.zip 3.6 KB · Views: 426 Last edited: Feb 26, 2020
I use HttpJob to download map image from WMS-server. The HttpJob reported this error message: java.net.SocketException: Address family not supported by protocol family: connect. I found that it could be Java that tries to use IPv6 addressing against a server that use IPv4 addressing, and that it could help setting the system property “java.net.preferIPv4Stack” to true. I added the following line: B4X: SetSystemProperty("java.net.preferIPv4Stack" , "true") in the AppStart Sub. It works in Release mode, but not in debug mode. How can i set the system property java.net.preferIPv4Stack so it works in debug mode? I use jdk1.8.0_231 Example project attached. Running in Debug causes the error, but running in Release do not.
stevel05 Expert Licensed User Longtime User Feb 25, 2020 #2 Works here for me in Java 11 and Java 8.0_192 B4X: Log(GetSystemProperty("java.net.preferIPv4Stack","NF")) SetSystemProperty("java.net.preferIPv4Stack" , "true") Log(GetSystemProperty("java.net.preferIPv4Stack","NF")) Gives: B4X: Waiting for debugger to connect... Program started. NF true But I can see the map if I comment the line out too. There are some more suggestions here: https://stackoverflow.com/questions...protocol-family-socketexception-on-a-specific Last edited: Feb 25, 2020 Upvote 0
Works here for me in Java 11 and Java 8.0_192 B4X: Log(GetSystemProperty("java.net.preferIPv4Stack","NF")) SetSystemProperty("java.net.preferIPv4Stack" , "true") Log(GetSystemProperty("java.net.preferIPv4Stack","NF")) Gives: B4X: Waiting for debugger to connect... Program started. NF true But I can see the map if I comment the line out too. There are some more suggestions here: https://stackoverflow.com/questions...protocol-family-socketexception-on-a-specific
Erel B4X founder Staff member Licensed User Longtime User Feb 26, 2020 #3 My guess is that this error is not related to IPv6 vs. IPv4. Upvote 0
knutf Active Member Licensed User Longtime User Feb 26, 2020 #4 Erel said: My guess is that this error is not related to IPv6 vs. IPv4. Click to expand... You have right, it was the adware PremierOpinion that caused the error. After uninstalling the adware HttpJob works as expected. stevel05 said: There are some more suggestions here: https://stackoverflow.com/questions...protocol-family-socketexception-on-a-specific Click to expand... Your link lead me to the right solution. Thank you Upvote 0
Erel said: My guess is that this error is not related to IPv6 vs. IPv4. Click to expand... You have right, it was the adware PremierOpinion that caused the error. After uninstalling the adware HttpJob works as expected. stevel05 said: There are some more suggestions here: https://stackoverflow.com/questions...protocol-family-socketexception-on-a-specific Click to expand... Your link lead me to the right solution. Thank you