Questions tagged [inetaddress]
227 questions
0
votes
2 answers
how to get hostname from android device
I'm implementing a method that gets the hostname of android device. I'm using InetAddress class for this. however, I'm getting fatal exception. Here's the method. I added a try/catch block, but still not working. Any help appreciated. Edited and…

miatech
- 2,150
- 8
- 41
- 78
0
votes
2 answers
Why python netaddr copies variable references instead of creating a new instance
I want to make a copy of an IPNetwork variable not reference (and change) the existing one. Why does changing 'x' below also change 'nw'?
>>> nw=IPNetwork('1.1.1.1/24')
>>> nw
IPNetwork('1.1.1.1/24')
>>> x = nw
>>> x.prefixlen = 28
>>>…

TG2
- 1
- 1
0
votes
0 answers
Inetaddress.getLocalHost() UnknownHostException Windows 8
I am attempting to use Elastic Search in a Spring program. Currently I am trying to create a Transport Client as per this guide. Unfortunately the InetAddress.getByName("localhost") is giving me an
unhandled exception type UnknownHostException
I…

Matthew Crichton
- 15
- 1
- 6
0
votes
0 answers
How can I know in Java if a interface is a wifi or ethernet connection?
I need to get the interface I'm using, in Windows I can do:
InetAddress.getLocalHost ()
But in Linux it does not work, unless you add to etc / hosts the IP of my computer.
So, I use NetworkInterface.getNetworkInterfaces () to get the list of my…

accnono
- 33
- 7
0
votes
2 answers
how to create a URL object using an InetAddress object in Java?
I have a need to create a http or https URL object from an IPv4 address (String or InetAddress objects - either one is ok) in Java. I have been at this for 10 hours now.
Attempts that hit a wall described below:
Attempt #1: I tried to make the URL…

Mike
- 371
- 1
- 4
- 18
0
votes
0 answers
Java native code and implementation of InetAddressImplFactory.isIPv6Supported()
In below inner class of java.net.InetAddress, there is a native method - isIPv6Supported(). Suppose, I am using Springs as application framework and deploying my application in Weblogic server, question is that whether this native method will be…

pjj
- 2,015
- 1
- 17
- 42
0
votes
2 answers
Using InetSocketAddress correctly
I am attempting to use the InetSocketAddress that is part of Java.net. Although when I try to actually give it data for its perimeters it does not work. The documentation does not actually specify how to define the IP address and port. It states it…

MicrosoftDave
- 301
- 1
- 3
- 12
0
votes
2 answers
InetAddress can't resolve some domains, throws java.net.UnknownHostException, but domains actually work in the browser
InetAddress fails to resolve the following domains:
kymcolux.com
shencan.net
zoocore.com
Tested on my home computer and a VPS with:
InetAddress addr1 = InetAddress.getByName("kymcolux.com");
https://httpstatus.io/ also can't fetch the…

ss1
- 1,009
- 15
- 32
0
votes
1 answer
How to get MAC Address of a network device using java
I am trying to develop an open-source network monitoring application
The application scan the network to find all connected devices. It shows all IPs in the given range but the connected devices will appear with checked box (JCheckBox). I list the…

Iyad Zabalawi
- 1
- 2
0
votes
0 answers
InetAddress to return the actual Public address of a website from IP
I have been trying several methods in some of the posts to get the actual Public Address from an IP(like facebook.com), but I have not been successful so far. I have been trying the below code to get the web address of facebook :
import…

learn_develop
- 1,735
- 4
- 15
- 33
0
votes
1 answer
How to create an INetAdress constructor
I have this code:
import java.net.InetAddress;
import java.net.UnknownHostException;
public class NsLookup {
private InetAddress inet = null;
public void resolve(String host) {
try {
inet = InetAddress.getByName(host);
…

johnnyboyjeb
- 15
- 3
0
votes
0 answers
Android InetAddress unreachable with http:// added to URL
I have the following:
try {
InetAddress.getByName(Constants.CORE_API_SERVER).isReachable(5000);
} catch (IOException e) {
Log.d("RegisterUUID", Constants.CORE_API_SERVER + " is NOT reachable");
}
The URL is:
public static final String…

dxhans5
- 127
- 1
- 12
0
votes
1 answer
Pinging multiple times using InetAddress makes GUI unresponsive
My program is to ping a host infinitely and display each ping result on the GUI as RED/GREEN. Here, 'res' is a label that changes its text and background based on the ping result.
The issue is that when i use while(), the GUI becomes unresponsive…

Harsh Kumar
- 3
- 1
0
votes
1 answer
IP address not reachable
I am trying to know if an IP address is reachable using the code below. But every time I am getting "Not Reachable" even though the machine is running. I have tried using several alive IPs but I'm always getting "Not Reachable". Please help.
public…

1fuyouinfinite
- 1
- 1
- 1
- 14
0
votes
1 answer
How can I get my LAN IP address using Java
I want to get my LAN IP address. But I it shows Localhost address using this code.
public static void main(String[] args)
{
try
{
InetAddress add=InetAddress.getLocalHost();
System.out.println("Local IP: " +…

Uzzal
- 21
- 4