Questions tagged [inetaddress]
227 questions
2
votes
1 answer
How to resolve java.net.ConnectException: /ip_address:port - Connection refused exception in android
I am getting java.net.ConnectException: /ip_address:port - Connection refused exception.
Here is the code:
public boolean sendMessage(String message, String ip, int port)
{
try {
Log.i("Log", "Socket Operator IP before…

Narendra Pal
- 6,474
- 13
- 49
- 85
2
votes
5 answers
Java InetAddress failed
I am trying to check if some host is reachable using the "isReachable" method.
line 113: oaiBaseURL = "http://www.cnn.com";//////////////////////////////////////
line 114: boolean res = InetAddress.getByName(oaiBaseURL).isReachable(10000);
line 115:…

Mike
- 1,007
- 2
- 16
- 33
2
votes
2 answers
How to check if an IP is contained in a network with python?
How do I check whether an IP is contained in a network with python?
Eg:
# pseudo code
IP('10.40.0.1').contained_in(CDIR('10.40.0.0/24)) == True

nemesisdesign
- 8,159
- 12
- 58
- 97
2
votes
2 answers
Java - How to invoke a IP Address to find host name?
The code I've made automatically returns the host name.
But instead of returning my machine's host name every time. I want to checkup on other machines as well (for testing purpose).
By that I mean, every time I call the method, it'll ask me to…

Dembele
- 963
- 4
- 10
- 19
2
votes
4 answers
Android Issue on some devices
I want to use the following code for my application:
InetAddress inetAddress;
try {
inetAddress = InetAddress.getByName(hostname);
} catch (UnknownHostException e) {
return -1;
}
It works well on most of the devices I've tested but…

Manitoba
- 8,522
- 11
- 60
- 122
2
votes
1 answer
How to ping a server from an android tablet
I am trying to write an android tablet application which scans for a set of ip addresses in the local network and check whether they are in use or alive. I am using the
InetAddress.getByName(ipAd).isReachable(100)
but when i check the logs it…

Mr.Noob
- 1,005
- 3
- 24
- 58
1
vote
1 answer
Match IPv4 address against pattern or dns
I have a IPv4 address which should be compared against a pattern. A pattern can either be a specific address maybe containing wildcards or a dns.
*
..*.*
192.168.*.5
206.0.3.4-25
45.30.9.101
www.google.de
I already figured out that the…

Sebastian Hoffmann
- 11,127
- 7
- 49
- 77
1
vote
1 answer
change location from where you ping to an IP address
My application is: ping host IP(in LAN) address from my machine.
InetAddress address = InetAddress.getByName("host IP address");
boolean b=(address.isReachable(10000));
When i run that web application ping is done from my machine so in my tomcat…

harry
- 731
- 10
- 23
1
vote
3 answers
Is the static method getByname of InetAddress class in java an example of Factory method pattern?
The standard factory Method design pattern talks of 4 classes.
Creator,Product n their concrete implementations.
So for each product we need to instantiate corresponding factory which has methods to create the product.
But I have also seen scenarios…

Amogh Talpallikar
- 12,084
- 13
- 79
- 135
1
vote
1 answer
How to write a DNS server connection based host resolver in Java?
By reading this article I was able to partially write a DNS server query based resolver that I added to the HostResolutionRequestInterceptor component.
But I'm unable to get all hostnames via IP using java.net.DatagramSocket and I can't implement…

Edgar Becker
- 63
- 6
1
vote
1 answer
How to configure host name resolution to use a custom host resolver that works in Java 8 and later?
According to this post there are several ways to configure a custom host resolver in Java, but each of these ways differs from the other and does not work for all java versions between 8 and the most recent.
The post indicated above is 10 years old:…

Edgar Becker
- 63
- 6
1
vote
0 answers
Why InetAddress.getLoopbackAddress().getHostName() is returning a localhost
So my problem is quite simple. I want to get the URL of current environment in my application is running. The application is deployed on linux server. The problem is when I try to get the host name for my application, I always return with the…

Eatsam ul haq
- 317
- 1
- 12
1
vote
0 answers
Android Unable to resolve host "" No address associated with host name
I have the following code to get IP address for certain url.
URL url = null;
String ip = null;
try {
url = new URL("https://stackoverflow.com/");
System.out.println(url.getHost());
InetAddress address =…

Jeff
- 293
- 4
- 13
1
vote
0 answers
Spring boot app starts slow without internet connection on Yocto Linux
I have a Spring Boot application running on a Yocto Linux that must work also without external internet connection from the network router. The Spring app is accessible within the LAN from other devices.
When the router internet cable is unplugged,…

Sorin Penteleiciuc
- 653
- 1
- 10
- 26
1
vote
1 answer
why does Eclipse memory analyser not show InetSocketAddress string values?
I am analysing a heap dump using eclipse memory analyzer tool. I am trying to list the SocktChannels and their remote addresses. I am unable to see their IP Addresses and the port. I use the following OQL :
SELECT x.toString() FROM…

Vayasaana Geek
- 11
- 1