Questions tagged [inetaddress]

227 questions
0
votes
1 answer

InetAddress Ip address lookup from hostname Android

I'm trying to get the IP address of a computer(or Raspberry Pi) from its hostname from an Android App using InetAddress,The problem is when i type "www.google.com" for example it works but when I try "PC****" which is my PC hostname (got it from the…
Hedi Jl
  • 29
  • 7
0
votes
2 answers

Is 234324.32423.234234.324234 a valid InetAddress?

Is there any way that InetAddress.getByName( 234324.32423.234234.324234 ) will return a non-null address value? Seems like it does. Since this happens in a unit test, all I have to do is force InetAddress to throw an exception. Is there any reason…
elieone
  • 1
  • 1
0
votes
3 answers

Response time out when pinging an IP address in Java

Here is what I use to ping an IPv4-Address and to record the actual response time in ms. Unfortunately I never get a valid response.. The request always times out. 0 is always returned. Please help :) private long pingHost(String host, int port) { …
chrisyou
  • 1
  • 1
0
votes
2 answers

Python 2.7.6 - For loop is not working with the nmap module

I have been at this for hours and I cannot figure it out. The script is supposed to scan servers for port 22. However, the very last line of the code errors out with "KeyError". What is confusing is that this only happens when I use a FOR loop or I…
0
votes
1 answer

How do I get My machine's IP address in java?

I am tryin to get my local machines IP address using java InetAddress. I can check in my network connections the IP address mentioned there is something different than the one returned by the program. Machine's IP address from network connections…
0
votes
1 answer

python netaddr find closest Ip address match

How can I find the closest match using python netaddr for same prefixlength? >>> l = ['172.27.145.130/25', '172.27.145.129/25', '172.27.145.131/25'] >>> myip = '172.27.145.129' >>> netaddr.IPAddress(myip) in netaddr.IPNetwork(l[0]) True >>>…
amulllb
  • 3,036
  • 7
  • 50
  • 87
0
votes
1 answer

converting InetAddress to string

Im using a hashtable to save filename (string) and InetAddress Hashtable file_location = new Hashtable (); and im using this to retrieve the address, but im only getting a null value…
Amr Hamada
  • 63
  • 1
  • 2
  • 8
0
votes
3 answers

InetAddress getAllByName does not manage order of return IP Addresses as mentioned in host entry

My Host entry as follow : 10.106.1.188 myhost 192.168.0.156 myhost 192.168.0.160 myhost 192.168.0.150 myhost 10.106.1.121 myhost 10.106.1.110 myhost I use following code for get all IP Address from host entry InetAddress[]…
Punit Patel
  • 901
  • 1
  • 12
  • 25
0
votes
0 answers

Multicast Chating, to get sender's login/pc name in host/listener's GUI

Help me guys, i was able to get the IP addres of sender in host/listener system, how to get sender's name, i think it should be "packet.getHostName(string ip-address)", where packet is reference of the packet received by the listener from sender. I…
0
votes
1 answer

Implement DNS pre-fetcher/resolver using InetAddress or Runtime.getRuntime().exec() in ANDROID

The HTTP connection to a hostname for the first time takes little longer than subsequent requests. Especially, DNS lookup takes long. I am trying to implement a basic DNS pre-fetcher/resolver using InetAddress or Runtime.getRuntime().exec() in order…
Nizzy
  • 1,879
  • 3
  • 21
  • 33
0
votes
2 answers

IPv6 - InetAddress.getAllByName returns inconsistent scope id

I am new to IPv6. I have a very simple code snippet as like below sample program to fetch and print the IP address of the host. public class networkinterfacetest { public static void main(String...args) { String host="BGL-351L"; try { …
vijayashankard
  • 721
  • 1
  • 7
  • 23
0
votes
3 answers

InetAddress.getByName cannot be resolved to a type

I am trying to use InetAddress to to return the IP address of a website name that the user enters, but I get an error at the statement: InetAddress ip = new InetAddress.getByName(site); The error shown is : InetAddress.getByName cannot…
user3883991
  • 71
  • 2
  • 6
0
votes
3 answers

How Can Get Local ipv6 adress in java

Hi everyone i want to get ipv6 address of eth0 interface, for example my eth0 interface: eth0 : Link encap:Ethernet HWaddr 11:11:11:11:11:11 inet addr:11.11.11.11 Bcast:11.11.11.255 Mask:255.255.255.0 inet6 addr:…
Erol Guzoğlu
  • 486
  • 6
  • 24
0
votes
1 answer

Reachability test always returns false using inetsocketaddress

I am trying to check rechability of host by following code : Socket socket = new Socket(); try { SocketAddress socketAddress = new InetSocketAddress(InetAddress.getByName("https://www.google.co.in"), 80); …
Rujul1993
  • 1,631
  • 2
  • 10
  • 10
0
votes
0 answers

java.net.Socket vs java.net.InetAddress

I recently came across two methods for checking whether a ip-address is reachable or not: 1) Using java.net.Socket 2) Using java.net.InetAddress Using (1), opens a TCP connection at port 80, whereas using (2) would typically use ICMP echo requests…
Bey0ndZ
  • 114
  • 3