Questions tagged [inetaddress]
227 questions
0
votes
1 answer
Java network programming InetAddress objects
I am creating a chat application using java sockets programming. I want to launch it in my local network which means my application doesn't require internet to run. I tested the application on my computer itself by using the…

nitish712
- 19,504
- 5
- 26
- 34
0
votes
2 answers
InetAddress withouth using Scriptlets
Is there a way to do:
java.net.InetAddress.getLocalHost().getHostName()
without using JSP Scriptlets?
Looking for a more conventional solution, probably using JSTL capabilities to achieve this.
Take note that ${pageContext.request.*} jstl function…

link_boy
- 1,025
- 4
- 12
- 23
0
votes
0 answers
InetAddress.getByName very slow for some hosts, but not others
I have noticed that InetAddress is very slow for some hosts.
Below is the relevant code
final long startTime = System.currentTimeMillis();
try {
System.out.println("start");
InetAddress address = InetAddress.getByName("smartface.com");
…

Arya
- 8,473
- 27
- 105
- 175
0
votes
0 answers
Problem using Java inetAddress.isReachable with AWS EC2
There is a simple code on Java 8 which just check if the host is reachable
InetAddress inetAddress = InetAddress.getByAddress(ipBytes);
return inetAddress.isReachable(timeOutMS) ? "UP" : "DOWN";
There are two different ip addresses (lets say…

Сергій Катрюк
- 51
- 7
0
votes
0 answers
How to retrieve the host name by IP with dnsjava library?
I'm trying to retrieve the host name (or domain) of an IP address with dnsjava library by using a SimpleResolver and the ReverseMap and I wrote the following code:
import java.net.InetAddress;
import java.net.UnknownHostException;
import…

Edgar Becker
- 63
- 6
0
votes
2 answers
Convert Set to Set in Java in a cleaner way
I have the following code:
Set ips = allowedIpsToDescriptions.keySet();
where allowedIpsToDescriptions is a Map
I'm trying to convert Set to Set and here's my code:
Set allowedIpsInetAddr =…

jayteezer
- 115
- 2
- 13
0
votes
2 answers
Is InetAddress a static class? why do we not use new key word with it?
Why we have not used newkeyword in the following program?
import java.net.InetAddress;
public class InetDemo{
public static void main(String[] args){
try{
InetAddress ip=InetAddress.getByName("www.pinterest.com");
…
0
votes
1 answer
InetAddress.getByName returns "akamaitechnologies.com for non-existent host
I have found that resolution of a hostname that does NOT exist always returns an address belonging to "akamaitechnologies.com" (e.g. 23.221.222.250). It does work correctly for hosts that do exist.
Code:
InetAddress addr = InetAddress.getByName(…

DontPanic
- 2,164
- 5
- 29
- 56
0
votes
2 answers
How does InetAddress find the IP of a given hostname?
How does InetAddress work? How does it find an IP address of a hostname.
I understand we can use InetAddress in Java for DNS resolutions, but I would like to know how it works. How does it find a DNS server to resolve the address?
I recently saw a…

Optimus Prime
- 6,817
- 5
- 32
- 60
0
votes
1 answer
In the internals of an ContextListener how can I find out the port the Web App is running on
In the internals of an ContextListener how can I find out the port the Web App is running on
I have a Java Web app project with JSP pages as frontend. The project implements a ServletContextListener to connect to the backend. This ContextListener…

halloleo
- 9,216
- 13
- 64
- 122
0
votes
0 answers
Android Studio No address associated with hostname using Inet Address
I'm having a problem with my ip lookup program in Java I've imported Inet Adress and implementd the async task and used the permission on the manifest but still shows the same problem.
The Error: Unable to resolve host "[Ljava.lang.String;@f1679a5":…

revolutionarybreak
- 17
- 7
0
votes
0 answers
I can't check any solution for Inet Address in Android
So I'm trying to get the Ips of the websites on my app and I'm having a lot of problem with this one as a newbie I'm searching everywhere but no clue. I tried on intelij and it works fine while on android it gives hell lot of…

revolutionarybreak
- 17
- 7
0
votes
2 answers
Inet Adress Library Shows: Main Thread Error On Java Android Studio App
I've Been creating an app about checking the ip of x websites and I've imported:java.net.InetAddress and It will work on intelij but on android studio the try/catch block catches some errors: android.os.NetworkOnMainThreadException. So this the code…

revolutionarybreak
- 17
- 7
0
votes
1 answer
How to know ip address with java.net InetAddress or other API
I have UDP server to listen messages, and I need to bind to device IP address. Other devices send messages on the UDP server. I use next:
InetAddress address = InetAddress.getLocalHost(); // gives 127.0.1.1 (1)
address =…

Valeriy K.
- 2,616
- 1
- 30
- 53
0
votes
1 answer
How to find SUB-NET for a defined IP Group.?
I need to find out how an IP group is divided between subnets inside the network.
For example, I have an IP range 192.168.0.0 - 192.168.255.255
and I have to guess how it's divided inside. Maybe they are divided in /23 or /24 or few of them are…

Rajesh Fujitsu
- 11
- 1