Questions tagged [inetaddress]
227 questions
0
votes
1 answer
UnknowHostException cannot recover when network is back but restart JVM solved it
From one timepoint, our JVM(In fact a Yarn NodeManager) start to report UnknownHostException;
It is reported by JVM code
return InetAddress.getByName(host);
for the next more than 2 days, the exception always exists; During the time it is…

wuchang
- 3,003
- 8
- 42
- 66
0
votes
2 answers
Java/Android error when using InetAddress
im triying to implement a ping option in my android app, but when y tried the following error is displayed in the debug console:
Error info displayed in console
I/System.out: Sending Ping Request to 127.0.0.1
I/Error starts here:…

NormanP
- 1
- 2
0
votes
0 answers
Ping a device in Java
I am trying to ping a device using an IP address in Java but my code returns true even when the host is unreachable. I am using the InetAddress class. Here is my code:
import java.io.IOException;
import java.net.InetAddress;
import…

Hotdot Cyber
- 361
- 1
- 5
- 21
0
votes
0 answers
InetAddress is not thread safe?
We use jdk1.8. The exception is bellow:
Caused by: java.lang.NullPointerException
at java.net.InetAddress$Cache.put(InetAddress.java:806)
at java.net.InetAddress.cacheAddresses(InetAddress.java:885)
at…

salexinx
- 99
- 1
- 4
0
votes
0 answers
DNS lookup through InetAddress API is not working as expected
I am using Linux machine and IP address is 10.32.17.63.
In DNS, I have made an entry for a domain with this IP ie example.com for 10.32.17.63.
when i do ping example.com, it is giving me IP means DNS is working fine:
ping example.com
PING…

VJS
- 2,891
- 7
- 38
- 70
0
votes
1 answer
Java Networking - Connecting two computers
I'm trying to write a simply program client-server program that would connect a Client machine to a Server machine.
My code so far works well on the localhost, but when I replace the ip address in the Client code to the local ip address of the…

AlexT
- 589
- 2
- 9
- 23
0
votes
0 answers
InetAddress.getByName, UnknownHostException on some devices
In an Android app executing the following piece of code to determine if a hostname is present in my network:
for (int i = 0; i < listOfHostnames.size(); i++) {
//noinspection unused
String hostname = listOfHostnames.get(i).getAddress();
…

Thought
- 5,326
- 7
- 33
- 69
0
votes
2 answers
Python how get /8 subnet for an IP addres
How can I get the /8 subnet containing a given ip address.
e.g., subnet 10.0.0.0/8 for ip 10.1.1.1
I tried it so for wit netaddr lib, but it doesn't do what it should
network = netaddr.IPNetwork(ip)
network.prefixlen=8
ip_subnet=network.cidr
ip is…

aTuring
- 47
- 6
0
votes
1 answer
inetAddress.getByName(address) unknownhostexception
Does the getByName work on a link with a path like https://stackoverflow.com/questions, or does the link have to include the host only(https://stackoverflow.com)?
I get unknownHostException when i use a link that contains a "/", any tips on how to…

Mase
- 85
- 2
- 11
0
votes
1 answer
Android, accessing device IP address using "Inet4Address.getLocalHost().getHostAddress();" throws exception
so I have an app that is running and on startup, I would like to be able to Get the IP address and display it as a String. I have been using the code below.
String ipAddress = "";
try{
ipAddress =…
0
votes
3 answers
find if there is an active internet connection java android
I'm trying to find out if there is an active internet connection in my app.
I need to know if I can access the network without any errors, sometimes I get "true" response even though I have not internet connection and that is because i'm still…

OrrGorenn
- 347
- 1
- 5
- 15
0
votes
1 answer
Cannot resolve symbol IPAddressUtil
I have a problem in my android studio(macosx) :
in InetAddress.java some import have problem
import sun.net.util.IPAddressUtil;
import android.system.GaiException;
import android.system.StructAddrinfo;
import libcore.io.Libcore;
editor says…

reza abolghasemi
- 3
- 3
0
votes
1 answer
Java InetAddress name resolution
I have the following question for all Java pundits out there.
I am trying to came up with a reliable way of creating an localHost InetAddress object as a fallback way to InetAddress.getLocalHost().
I am facing the following issue:
There are cases…

akortex
- 5,067
- 2
- 25
- 57
0
votes
1 answer
Internet Control Message Protocol for Java
Pls help me guys. I end my work for one simple program. I need to check a servers status. I tried to use InetAdress.isReacheble and Socket. But sometimes if server on windows I get a server status false. After reading a lot of information, I…

Ruslan Yankov
- 1
- 3
0
votes
1 answer
How can i get the username and domain name of client system in java as i can get the ip address and host name using request.getRemoteHost
out.print( "ip : "+request.getRemoteHost() );
InetAddress ip= InetAddress.getByName(""+request.getRemoteHost());
String host=ip.getHostName();
InetAddress host1=ip;
out.print("host "+host);
How can i get…

HK2
- 17
- 1
- 5