Questions tagged [inetaddress]
227 questions
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 = ??

Ravi Bashar
- 1
- 5
0
votes
1 answer
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);
…

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,…

SagittariusA
- 5,289
- 15
- 73
- 127
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…

Diego Fernando Murillo Valenci
- 1,407
- 3
- 24
- 47
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…

Vagelism
- 601
- 1
- 16
- 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
{
…

ramulu ponnam
- 267
- 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…

Brane
- 139
- 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…

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…

Arun kumar R
- 235
- 3
- 12
-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…

Chandru
- 61
- 7
-1
votes
1 answer
Why do we need to AND to print IP address
This might be something obvious but i'am missing it. Why do i need to perform AND with 0xff to obtain ip address? The way i see it is exactly the same thing, perform AND with 0xff should leave the bits the same, so why doesn't it work if i don't do…

vanmarcke
- 133
- 1
- 1
- 7
-1
votes
1 answer
How to send datagram to other machines from one ip address to another ip address in java
I want to send some messages to other machines by using UDP protocol in Java. And I knew my ip address and the broadcast address it should advertise on. Like my ip address is 127.0.0.1, and the I the other address is 127.0.0.200. I want to broadcast…

user2193727
- 1
- 3
-2
votes
1 answer
Mockito not returning expected String instead it returning mocked object
I am mocking InetAddress, When I am mocking this I am getting mocked object instead of my expected string
InetAddress inetAddress = Mockito.mock(InetAddress.class);
Mockito.when(inetAddress.getHostName()).thenReturn("test")
…

Ravat Tailor
- 1,193
- 3
- 20
- 44
-2
votes
1 answer
IntelliJ: Why java.net.InetAddress is deprecated Class?
I've got a some problem. My program cant't run, throws: nullPointException. On other IDE it's running.
One day ago I just click something, I don't know what that was :(
Now this is look like this:
InetAddress localHost =…

Karol Mks
- 11
- 2
-2
votes
3 answers
Check if website is available
I want to check if website is available. It works when website is available, but it crash everytime when you can't connect to the website. If there is problem with NetTask class.
String netAddress = null;
try
{
netAddress = new…

Ewa Śniecińska
- 91
- 1
- 7