Questions tagged [inetaddress]
227 questions
1
vote
1 answer
Memory and Perf comparison of BigInt vs Byte array in scala
I have to use a type that can hole Ipv4 and Ipv6 addresses in memory efficient manner (in scala). As well as they should be performant. The two options I see are, using the scala BigInt type or a byte array. What the memory/perf hit in both cases?

Sayantan Ghosh
- 998
- 2
- 9
- 29
1
vote
1 answer
How to create InetAddress object in android?
HI!
I am writing code that will run in android. I want to get the IP address of my pc i.e connected to the same network. i.e My Phone is connected via wifi and the pc is connected via ethernet cable to the same router. I am able to ping my pc from…

Fahad Ali
- 21
- 2
- 4
1
vote
0 answers
Getting an intersection between 2 CIDR spaces when you have huge data sets
Basically, I have a list of IP subnets (supernets) which contains around 100 elements. In the same time, I have another list (ips) which contains around 300k of IP addresses/networks.
Example:
supernets = ['10.10.0.0/16', '12.0.0.0/8']
ips =…

Mohamed Kamal
- 63
- 5
1
vote
1 answer
Is underscore support in hostname?
In my unix vm, I can give the following entry in /etc/hosts
ABC_XYZ_HOSTNAME.abc.com 15.115.112.*** and after that I can "ping ABC_XYZ_HOSTNAME.abc.com" successfully. But my code is breaking at
InetAddresses.forString(ip)
with exception,…

abyin007
- 361
- 2
- 4
- 14
1
vote
1 answer
Loop continuously between a specified range java
I am making a Java application that will loop through my DHCP table and attempt connection to multiple devices. I am looping through an IP range, but would like to continuously loop through the range until the application is closed.
What would be…

steam1234322
- 63
- 1
- 6
1
vote
1 answer
Is there a minimum timeout to InetAddress isReachable method?
I'm having a weird behavior with the isReachable method of InetAddress class.
Method prototype is :
public boolean isReachable(int timeout)
When using a timeout > 1500 (ms), the method waits the exact time
given as argument (if the target IP is…

Lucien
- 451
- 4
- 16
1
vote
1 answer
Capture packets details from IP address in java
i am writing a java program to get all the IP addresses in my network
everything is going right using this code
InetAddress localhost = InetAddress.getLocalHost();
byte[] ip = localhost.getAddress();
for (int i = 1; i <= 254; i++)
{
ip[3] =…

iosamammohamed
- 317
- 3
- 18
1
vote
1 answer
PostgreSQL: Comparing first 3 numbers of an IPv4 address?
I'm trying to program a PHP-script, where users
can rate the "goodness" of the other users:
create table pref_rep (
id varchar(32) references pref_users(id) check (id <> author),
author varchar(32) references…

Alexander Farber
- 21,519
- 75
- 241
- 416
1
vote
3 answers
Java: Cannot initialize InetAddress
I can't seem to be able to initialize InetAddress object for some reason, I looked at the documentation and it is exactly as how I use it.
InetAddress firstMachineAddress = InetAddress.getByName("129.26.70.95");
InetAddress secondMachineAddress =…

Schütze
- 1,044
- 5
- 28
- 48
1
vote
2 answers
which is better between getting hostname using InetAddress or System.getenv
I posted a question about a problem that concerns inetaddress in java 8 : InetAddress java 8 is not getting the hostname
however I found a simple solution by using System.getenv("HOSTNAME") instead of InetAddress.getLocalHost().getHostName()...
I…

Mohamed Taboubi
- 6,663
- 11
- 55
- 87
1
vote
1 answer
InetAddress IPv4 reverse dns lookup
I've come at this problem every way I could think of, but no luck. I need to perform a reverse DNS lookup using an IPv4 address with the InetAddress class in java. I know there are better libraries for this but I have to use InetAddress because it…

BobFromBilling
- 85
- 1
- 9
1
vote
0 answers
How do I get host names by using IP, MAC addresses in android
I need to get the details of all wireless devices that are connected to my wifi network. I'm getting IP, MAC addresses, somehow Vendors of device as well.
How do I get the device type? (i.e laptop, mobile, AC, Refrigerator) And host names?…

Santhosh
- 4,956
- 12
- 62
- 90
1
vote
1 answer
Can not find symbol InetAddress.getByAddress()
I'm trying to make a connection to a web server and check if it's reachable from my computer. The problem is that when I try to use InetAddress.getByName(address) I get a compilation error:
Error:(20, 50) java: cannot find symbol
symbol: class…

ulmaxy
- 820
- 2
- 14
- 22
1
vote
2 answers
Bad behavior with InetAddress.getLocalHost().getHostName() in Java 8
I need to know the name of the current computer.
The simplest method is by running:
java.net.InetAddress.getLocalHost().getHostName()
With OpenJDK 7 in a Linux machine, the result is correct, as reported by the system command hostname.
But with…

david.perez
- 6,090
- 4
- 34
- 57
1
vote
0 answers
Java Networking (Help for my project)
This code list all connected ip's on network (localhost) but I would like that the list of ip's depends to the interface name. Please help me!
Example:
Interfaces:
eth1
eth2
Enter the interface number:
public static void main(String[] args)…

Med
- 2,772
- 1
- 11
- 14