Questions tagged [inetaddress]
227 questions
2
votes
1 answer
How to bypass the hosts file when doing an nslookup in Java using InetAddress
Is it possible to force Java to ignore the hosts file when doing a DNS lookup (or reverse DNS lookup)?
I have been looking into how to perform an nslookupin Java for quite a while, and all examples I can find end up using some variation of this…

Joe
- 113
- 4
- 12
2
votes
1 answer
How InetAddress object returns true when it calls isAnyLocalAddress()?
I write a program to check whether a given IP address is Any Local Address or not as:
import java.net.*;
class GetByName
{
public static void main(String[] args) throws Exception
{
byte[] b = {0, 0, 0, 0};
…

my name is GYAN
- 1,269
- 13
- 27
2
votes
0 answers
How to get device's (android)name when we know its Ip address connected under same network?
We got IP addresses of all connected devices under network by using the isReachable() method. (We are checking each IP manually by this method.)
We are intending to get the device name which we assign initially to our android device.
Is there any…

Bond
- 53
- 1
- 12
2
votes
2 answers
How to convert IPv6 Addresses to and from BigInteger in Scala
Looking to convert IPv6 Strings (such as 2001:0:4137:9e76:34b7:2e31:3f57:fd9a) to BigInteger and from BigInteger to IPv6 Strings.

Garren S
- 5,552
- 3
- 30
- 45
2
votes
1 answer
Comparator adding blank cells to near top of JTable
I have a comparator which takes strings, converts them into InetAddress. However if a string = "" it places the row near the start but after the rows with the value 0:0:0:0:0:0:fff:ffff.
import java.util.Comparator;
import…

Dan
- 7,286
- 6
- 49
- 114
2
votes
0 answers
Resolve Ip address from hostname for other devices connected through wifi network android programmatically
From my testing android device i want to get IP address through host name of particular device connected through wife network this below code runs fine in some testing android devices but in other devices its give me UnknownHostException, Why it is…

shyam002
- 237
- 1
- 5
- 19
2
votes
0 answers
why String got appended with un-printable characters
I want to obtain ip address by using this following classes, and accidentally found out that the ipAddress from the following code sometimes contains un-printable characters such as DC2, CAN...I would like to see if you know what cause this result…

bj4947
- 880
- 11
- 32
2
votes
2 answers
Understanding the Python netaddr library commands
I am trying to understand how some code operates from the netaddr Python tutorials on https://pythonhosted.org/netaddr/tutorial_01.html. In particular the following tutorial.
Summarizing list of addresses and subnets
Another useful operation is the…

algorhythm
- 3,304
- 6
- 36
- 56
2
votes
1 answer
How to get listening server port in Java?
My application is deployed in websphere server and from java code, I need to get listening port of the server.
NOTE:
I am using below line for getting internal host name of the system.
InetAddress.getLocalHost().getHostName();
EDIT:
Our server is…

Tapas Jena
- 1,069
- 4
- 14
- 23
2
votes
1 answer
find the network connection type(wired or wireless) by its IP address in java
I want to list all the devices connected to my network, I done like this
InetAddress i = InetAddress.getLocalHost();
byte[] ip1 = i.getAddress();
for (int b = 0; b <255;b++) {
ip1[3] = (byte)b;
InetAddress address =…

palavesa muthu
- 73
- 11
2
votes
1 answer
Xamarin INetAddress.GetByName always throws exception
I'm trying to get the INetAddress with the following code:
try
{
var address = InetAddress.GetByName ("google.com");
System.Diagnostics.Debug.WriteLine (address);
}
catch (Java.Net.UnknownHostException)
{
System.Diagnostics.Debug.WriteLine…

BisaZ
- 221
- 1
- 2
- 9
2
votes
2 answers
Occasional error Using InetAddress.getByName()
In my application, I use InetAddress.getByName() quite a bit to convert strings like "192.168.1.56" to InetAddress objects -- mainly because it seems to me to be a good idea to store IP addresses as IP addresses rather than as strings. Up til now,…

Rich
- 4,157
- 5
- 33
- 45
2
votes
0 answers
Error when calling java.net.InetAddress.getLocalHost
I have problem running java program which call InetAddress.getLocalHost as a non root user
on a specific linux rhel machine.
I tried running the program in another machine without any problem (either as a root or non root user).
Error:
at…

user3737906
- 89
- 1
- 9
2
votes
1 answer
Getting Yahoo IP address is not working
I get the Yahoo IP address using InetAddress class in java. The result of yahoo.com IP address is not working while given in URL of web browsers.
InetAddress[] all = InetAddress.getAllByName("www.yahoo.com");
for (int i=0; i

Venkat
- 20,802
- 26
- 75
- 84
2
votes
1 answer
get IP from socket connect from localhost in java
how i get ip of socket conncet from localhost ?
i try this :
ServerSocket ss = new ServerSocket(1919);
Socket test,s = new Socket("127.0.0.1",1919);
test=ss.accept();
System.out.println("we connect ");
InetAddress…

zdi301
- 55
- 2
- 9