Questions tagged [inetaddress]
218 questions
0
votes
1 answer
Get my address with InetAddress in Android
I have this JAVA code
package com.log.app;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class Adressage {
public static String GetMyAdress() {
InetAddress address;
String HostIP = null;
…
![](../../users/profiles/2250162.webp)
HobbitOfShire
- 1,604
- 4
- 19
- 40
0
votes
1 answer
Android unable to add getByName
I'm trying to add getByName to get the IP address of a hostname and use it in my POST command
the problem is wherever i insert this code it crashes
i tried to insert in doInBackground it also crashes So where should i insert it ??
package…
![](../../users/profiles/1928775.webp)
user1928775
- 255
- 1
- 5
- 15
0
votes
0 answers
InetAddress.getLocalHost() returns null in browser
I wrote an applet which takes the MAC address from the local computer.
It works fine on eclipse but at the moment I try to run it via the browser it does not.
after some debugging i've come to realize that this part returns null on…
![](../../users/profiles/1012646.webp)
Ido Barash
- 4,186
- 9
- 36
- 70
0
votes
1 answer
How do I check if InetAddress was created using a hostname or an IP address?
I would like to know that if an InetAddress object was initialized with a hostname or an IP address at construction. Is there a way to check that in java?
![](../../users/profiles/594200.webp)
SurenNihalani
- 1,210
- 2
- 14
- 28
0
votes
1 answer
Android How to check URL name or IP is rechable
My code is as follow:
public chkRechable(String hostNameOrIp) {
boolean isRechable = InetAddress.getByName(hostNameOrIp).isReachable(30);
return isRechable;
}
Parameter can be "http://192.168.0.77:8080/ws/api/customer/5" or…
![](../../users/profiles/1944451.webp)
ray
- 4,068
- 7
- 26
- 40
0
votes
4 answers
How to convert array Type InetAddress into String[]?
How to convert array Type InetAddress
InetAddress[] inetAddress
into String Array as in given below format !!
String[] addrSplit = ??
![](../../users/profiles/1957190.webp)
Ravi Bashar
- 1
- 5
0
votes
2 answers
How to pass array of "hostnames" in "InetAddress" method rather than passing one single hostname
How do you pass multiple "hostnames" in following chunk of code where we are only passing one hostname? Is it possible?
private static void run() {
String host = "www.google.com";
try {
inetAddress = InetAddress.getAllByName(host);
…
![](../../users/profiles/1957190.webp)
Ravi Bashar
- 1
- 5
0
votes
2 answers
Java: Get my own ip address in my home network
I have find two examples on the web to get the ip address the router has given to my pc.
Here is the code:
import java.net.InetAddress;
import java.net.UnknownHostException;
public class tryNet {
public static void displayStuff(String whichHost,…
![](../../users/profiles/1576208.webp)
SagittariusA
- 4,795
- 15
- 57
- 112
0
votes
1 answer
how to use InetAddress in Windows host with firewall
I want to get an example or suggestion of how to use InetAddress in windows systems with firewall active. I don't know what is blocked by the firewall that isn't allowing this class in windows to work.
When I try to use this code in windows with…
![](../../users/profiles/813353.webp)
Diego Fernando Murillo Valenci
- 1,237
- 2
- 21
- 42
0
votes
1 answer
How to ping and keep statistics in Java
I have a task to make a simple console pinger in Java.
I tried the following code and I have 2 main issues.
First of all even if I am connected to the internet (I can ping from console any site), when I run the code returns false.
Second, is it…
![](../../users/profiles/1249399.webp)
Vagelism
- 601
- 1
- 13
- 27
0
votes
1 answer
How to increase an ipv6 address based on mask in java?
i am trying to increment ipv6 address based on mask.
i am getting problem when there is F in place of increment.
could any one plz check this
public String IncrementIPV6ForPrefixLength (String IPv6String, int times) throws UnknownHostException
{
…
![](../../users/profiles/948717.webp)
ramulu ponnam
- 237
- 1
- 4
- 11
0
votes
1 answer
Java search form to query IP numbers
String Ipnumbers = request.getParameter("Ipnumbers");
String variant = request.getParameter("variant");
String strQuery = "SELECT Ipnumbers, username FROM brane where val(Ipnumbers) ";
if (Ipnumbers.equal("superior"))
strQuery += "> " + Ipnumbers…
![](../../users/profiles/1580187.webp)
Brane
- 109
- 1
- 2
- 6
0
votes
3 answers
Server Socket Error
i have got an error in this line:
new ServerSocket(2106, 50, InetAddress.getByName("83.4.200.1"));
Error log:
Exception in thread "main" java.net.BindException: Cannot assign requested address: JVM_Bind
83.4.200.1 is my ip, when i put there…
![](../../users/profiles/1451415.webp)
user1451415
- 107
- 5
-1
votes
1 answer
In a multi NIC system, which system NIC IP is returned by InetAddress.getByName(hostname)
I have a multi NIC system where NIC_1(public network), NIC_2(private network) are associated with IP_1, IP_2 respectively. Using the system's hostname I tried to get the system IP using InetAddress.getByName(hostname) and I found that the…
![](../../users/profiles/1648878.webp)
Arun kumar R
- 135
- 7
-1
votes
1 answer
Get InetAddress list using regexp in Java
Is there a way to use regular expressions and get a list of IP address? In my case, there are aliases defined with numbers in the system for each device interface and I need to fetch the list using aliases. For test systems, all aliases could map to…
![](../../users/profiles/2820700.webp)
Chandru
- 61
- 6