inetaddress

Java: convert int to InetAddress

I have an int which contains an IP address in network byte order, which I would like to convert to an InetAddress object. I see that there is an InetAddress constructor that takes a byte[], is it necessary to convert the int to a byte[] first, or is there another way? ...

Is there an easy way to convert String to Inetaddress in Java?

I am trying to convert strings into Inetaddress. I am not trying to resolve hostnames, the strings are ipv4 addresses, does InetAddress.getByName(String host) work? Or do I have to manually parse it? ...

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<all.length; i++) { System.out.println(" address = " + all[i]); } ...

How to turn Java class into one of its subclasses (SocketAddress and InetSocketAddress)

I am trying to get the IP of a socket connection in string form. I am using a framework, which returns the SocketAddress of the received message. How can i transform it to InetSocketAddress or InetAddress? ...

Avoid using InetAddress - Getting a raw IP address in network byte order

Hey, I am trying to use the MaxMind GeoLite Country database on the Google App Engine. However, I am having difficulty getting the Java API to work as it relies on the InetAddress class which is not available to use on the App Engine. However, I am not sure if there is a simple workaround as it appears it only uses the InetAddress clas...

isReachable in Java doesn't appear to be working quite the way it's supposed to

I'm using Clojure, but I can read Java, so this isn't a Clojure specific question. This doesn't even seem to be working from Java. I'm trying to implement a bit of a 'ping' function using isReachable. The code I'm using is this: (.isReachable (java.net.InetAddress/getByName "www.microsoft.com") 5000) Translated to Java by a good frie...

How to store both IPv4 or IPv6 in single column in SQL Server?

shall I use binary(16)? or varbinary(16)? I know I can use getAddress() in java.net.InetAddress (Java) or System.Net.IPAddress (C#) to get a byte[] representation of both IPv4 and IPv6, but if I need to insert IPv4 i.e. binary(4) into a binary(16) field in SQL Server, do I need to worry about padding or anything? Thanks ...

Java application wanting to use both Inet4Address and Inet6Address at the same time

I have a Java application that needs to connect via sockets to two different servers on two separate machines. One server has been configured to listen on IPv4 connections, while the other has been configured to listen on IPv6 connections. Now, assuming "host1" is the machine name of the server listening on IPv4 connections, while "hos...

a funny thing happens... ExecutorCompletionService

I have an application written in java that needs to find all the reachable hosts on the network. I use inetAddress.isReachable to do this with a timeout of 2000 milliseconds. i look up the current local machines ipaddress and based on that i attempt to reach the other ip addresses that end 1 - 255 missing out the local machines ip addr...