Nodediscovering via InetAddress.isReachable
Hi,
I'have to test if an host is reacheable, so I'm using InetAddress.isReachable(int timeout) method in j2se5.
I've started using it in an application built on win enviroment and it seems works properly, now I'm trying it in a linux environment a I've some problems to reach nodes (I thinks it's related to firewall or similar network problems).
Method description says:
+"...A typical implementation will use ICMP ECHO REQUESTs if the privilege can be obtained, otherwise it will try to establish a TCP connection on port 7 (Echo) of the destination host.."+
what exactly means?
thank in advance
This isn't really a JMX question, and you might want to ask it on a networking forum. But here's my take.
ICMP ECHO REQUEST is what the ping command uses. If the ping command does the right thing in your environment, then InetAddress.isReachable should too.
As you probably know, TCP/IP has port numbers, some of which have a standard use, like port 80 for HTTP. Port 7 is reserved for the Echo service, which just sends back everything it receives. You can typically tell whether the host "blibby" is running this service with the command "telnet blibby 7". But many machines do not have this service enabled.
If you are on host blobby and neither of the above works against host blibby, then InetAddress.isReachable won't work either. More generally, if InetAddress.isReachable returns true then the host is reachable, but if it returns false then you can't really know whether the host is reachable. Where possible, a better approach is to try doing whatever you would want to do with the host and see if it works. For example, if you're going to need to do an HTTP request, just try to connect to port 80 and see if it works. You might want to use a technique similar to what I describe at http://weblogs.java.net/blog/emcmanus/archive/2007/05/making_a_jmx_co_1.html
Regards,
Eamonn McManus -- JMX Spec Lead -- http://weblogs.java.net/blog/emcmanus
Similar Messages
-
InetAddress.isReachable() is acting strange
I have three machines. One server running Linux, one PC inside our firewall running XP and one PC outside our firewall running XP. The PC outside our network is connected through a VPN to our network.
I have a little java application running on both XP machines that check to see if the Linux box is reachable.
import java.io.*;
import java.net.*;
public class Reachable
public static void main(String args[])
while (true)
try
InetAddress address = InetAddress.getByName("tux.xyz.com");
System.out.println("Name: " + address.getHostName());
System.out.println("Addr: " + address.getHostAddress());
System.out.println("Reach: " + address.isReachable(3000));
catch (UnknownHostException e)
System.err.println("Unable to lookup tux.xyz.com");
catch (IOException e)
System.err.println("Unable to reach tux.xyz.com");
try
Thread.sleep(1000);
catch (Exception e)
}The XP box that inside the firewall says that the Linux box IS reachable, but the XP box that is outside the firewall says that the Linux box IS NOT reachable.
We have checked our firewall and both XP boxes are getting through on port 7. The Linux box is getting the requests on port 7 also as I can see them using Ethereal.
Any ideas why InetAddress.isReachable() would be returning FALSE?
FYI, if I turn on the echo server on Linux, which uses port 7, the XP machine outside the firewall NOW says that the server is reachable...
Much thanks.
-JeffYeah, did notice that reply, but what is weird is that I am not getting a connection refused. I am not getting anything...
The Linux server is visible from both the inside XP machine and outside XP machine via ping. What I thought was weird was that the inside XP machine was able to get to the Linux box, but the only way the outside machine was able to get to the Linux box was when I turned on the Echo service on port 7. That is what is weird. So turning on the Echo service made sense, but did not at the same time... -
InetAddress.isReachable() only returns true
Hello,
Im trying to use the InetAddress.isReachable() method to get the host reacheability, but it only returns true to all addresses, being available or not...... in sniffer all appear to be ok, i can see the icmp packets incoming and outgoing....
Somene could help me? :D
thanks...jverd, because the network address that im using in
this test is not being used in my network, i can see
it using ping tool from my desktop, and because the
sniffer shows me that the ping is requested, but does
not get response... ok?Okay, so this is a local address? Like a 192.168, or a 10. or 172.whatever? And you're certain there's no computer that has that address?
Just because ping fails doesn't mean nothing's there. A host might be there and not answering ping. isReachable also tries a TCP connection on port 7.
Try telnet the_supposedly_bad_address 7 and see if it responds. If so, then there's a host at that address, and isReachable is correct. If it doesn't, then it would seem to be a bug in isReachable (though I'm still not totally sure). -
Problem with InetAddress.isReachable() - no ICMP
Hi,
I'm using Java 1.5 (build 1.5.0-b64) under Debian. My Problem is, that isReachable only tries to connect via tcp and does not send ICMP packets (checked with tcpdump)
The Doku says "A typical implementation will use ICMP ECHO REQUESTs if the privilege can be obtained". So what can I do to give java the privilege to send ICMP?
thanks
FrankIt's an USER privilege. You can get the privilege:
- Setting the SETUID bit in the java executable as "root" or other user that has the privileges (not advisable)
- or
- Running the program as "root" (using "sudo" or "su") -
InetAddress.isReachable() returns true?!?!?!
The following Program finds a non existent host in my subnet. Does anybody know why?
The system is j2sdk1.5.0-beta installed on Windows Xp professional, SP1 (German).
---The source:
import java.util.*;
import java.net.*;
public class IsReachableTest {
public static void main(String[] args) {
System.out.println(
System.getProperty("java.vendor")+" "+
System.getProperty("java.version")+" running on "+
System.getProperty("os.name")+" "+
System.getProperty("os.version"));
for(int i=1;i<255;i++){
try{
long start=new Date().getTime();
if(InetAddress.getByName("192.168.119."+i).isReachable(100)){
System.out.println("192.168.119."+i+"--"+(new Date().getTime()-start));
}catch(Exception e){System.out.println("ERROR "+e.toString());}
System.out.println("done.");
---end source
---The output:
Sun Microsystems Inc. 1.5.0-beta running on Windows XP 5.1
192.168.119.1--40
192.168.119.12--0 <----- HERE
192.168.119.70--0
192.168.119.252--0
192.168.119.254--0
done.
----end output
There is definitively not a host with this address in the subnet.
Neither "ping 192.168.119.12" nor "telnet 192.168.119.12 7"
find any host.
Is this a bug in tiger?This is, what I was waiting for since and now it
doesn't work :-(
Nobody has Tiger beta and can test it ?????tested it and works for me:
Sun Microsystems Inc. 1.5.0-beta running on Windows XP 5.1
192.168.0.1--31 <-- my router
192.168.0.2--0 <-- this machine
done.ethereal showed that icmp echos were used to test reachability (logged on as user with administrator privileges)
-robert -
InetAddress.isReachable returns a false reading
I am creating a program to ping based on a bacth file of PC host names. It works great except for a few instances. In these instances, isReachable will return true, but when I try to manually ping the hosts it times out.
I think that the issue may be related to cached entries in the DNS server, but I am not certain. The reason I think this is because when I ping the odd instances from command, it shows the IP address. This is not the case with the others. Could this be giving off a false reading? Though, when I use the IP address itself in the Java program (rather than the host name), I still get a false reading - in this case, it would not even be using the DNS server, correct? I thought that isReachable waited for an echo reply?
Is there any other way I can go about this program, or any workaround for this issue?Do you have several threads invoking isReachable around the same time? If so, then perhaps this is the issue:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6595834 -
Is the isReachable() thread safe ? How to approach it ?
I've created a ping class which uses InetAddress.isReachable().
I have 100 devices, with 100 threads which are using the ping object instances simultaneously.
When one device is not reachable ( it doesn't responde), the next 5 o 10 ping test fail as well.
I've read that isReachable is not thread safe, is this true ?
This is the code that performes the ping.
final long start = System.nanoTime();
if (InetAddress.getByName(sIp).isReachable(5000)) {
result=(System.nanoTime() - start) / 1000 / 1000;
} else {
result=-1;
Thanks for your help.I am not sure measuring the time in seconds will be very useful unless you are trying to detect very slow response times.
Do you investigate using broadcast pings i.e. it pings every box at once.
Why do you have such along timeout?
Even testing a box on the other side of the world on a decent WAN should be less than 400 ms.
What do you mean by the next 5 to 10? Do you mean in the same thread or between theads or is it that the boxes that timeout all have the same timeout so they fail at the same time? -
Prepared SQL statement to test existence of a value in a row
Excuse my ignorance in SQL. I didn't do much in SQL queries or DB design in general, but I'm eager to learn.
Idea behind: I'm traversing a directory tree (Java, jdbc) (depth first) and want to collect all files
in that tree and put the as BLOBS into the database.
To find out whether a file is the same as another file (possibly in a different path) I calculate the md5sum
(not sure whether it is proof against collisions or if I should use SHA-256 or some combination of md5sum + chksum).
Anyway, let the md5sum be the unique value that makes the identity of a file for now.
My problem: Find the jdbc/SQL statements that let me decide whether the file (md5sum) is already stored in a ROW
upon which I can decide to either do the INSERT or mark the existing file as being present in a different path.
I stumbled across the problem in the moment when I first time tried to INSERT a row and got told that
md5sum gotta be unique.
Any ideas for design and query? The code example below is incomplete. Especially what I'm looking for is
how to construct a prepared SQL statement into which I can inject the variable later found (md5sum)
Whether I should do that by COUNT(*) or a different method?
Christoph
Here is my sketchy code (Netbeans project) under construction:
* To change this template, choose Tools | Templates
* and open the template in the editor.
package testsqlite;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.sql.*;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
* @author chris
public class Main {
* @param args the command line arguments
private static Connection conn;
private static String sql="INSERT INTO part(name,md5sum) VALUES (?,?)";
private static PreparedStatement pstmnt,pstmnt_ifexists ;
private static String sql_ifexists="SELECT COUNT(*) FROM part WHERE md5sum=?"; // ???
public static void main(String[] args) throws Exception{
// TODO code application logic here
System.out.println("Testsuite-Collector\n");
String path="c:/usr/local/www/data/testsuite/mandanten/chris/probanden";
File f = new File(path);
Class.forName ("org.sqlite.JDBC");
conn =
DriverManager.getConnection("jdbc:sqlite:c:/users/chris/testsuite/versionen");
Statement stat = conn.createStatement();
pstmnt = conn.prepareStatement(sql);
pstmnt_ifexists = conn.prepareStatement(sql_ifexists);
// process
Traverse(f);
// watch result
ResultSet rs = stat.executeQuery("select * from part;");
while (rs.next()) {
System.out.print("name=" + rs.getString("name") + " ");
System.out.println("md5sum= " + rs.getString("md5sum"));
rs.close();
conn.close();
private static void Traverse(File f) throws IOException {
File[] files = f.listFiles();
for( File file : files) {
if(file.isDirectory()){
Traverse(file);
else {
try {
if(file.length() > 0){
FileInputStream fis = new FileInputStream( file );
String md5 = org.apache.commons.codec.digest.DigestUtils.md5Hex( fis );
System.out.println(file.length() +" " md5"->"+file.getPath());
// check whether md5sum is already existing
pstmnt_ifexists=?????
pstmnt.setString(1, file.getPath());
pstmnt.setString(2, md5);
pstmnt.executeUpdate();
catch (SQLException e) {
System.out.println("SQL error:" e.getMessage()"\n");
}And you seriously think that attempting to insert a record and catching the error of it failing is a good design!?!?I certainly do. I agree with Peter here. You can either test for the existence of the record and insert it if absent, or insert the record willy-nilly and catch the exception. The second option is (a) atomic even without transactions and (b) clearly twice as efficient. Same consideration applies to e.g.
if (!map.containsKey(key))
map.put(key, value);
else
; // it was already thereas opposed to
if (!map.put(key, value)
; // it was already thereand many other situations of this kind, e.g.
try
if (InetAddress.isReachable(ip))
s = new Socket(ip, port);
else
; // host not up
catch (ConnectException exc)
// the host wasn't up during connect
}as opposed to
try
s = new Socket(ip, port);
catch (ConnectException exc)
// host not up
}or
try
if (file.exists())
in = new FileInputStream(file);
else
; // it wasn't there
catch (IOException exc)
// it wasn't there, etc ...
}as opposed to
try
in = new FileInputStream(file);
catch (FileNotFoundException exc)
// it wasn't there
}Slight absence of timing window problems in the cases that detect via exceptions, and considerably simpler code. Phobias about how to use exception handling need to be overcome.
I've also had it seriously argued to me that you shouldn't catch EOFExceptions, merely change the format of your file so you 'know' when one is coming up. Sorry to say that I think this sort of thing is complete rubbish. There is a need for an out of band EOF signal with all the readXXX() methods, and this is it. -
Finding out all systems connected to a LAN
Hi All...I am interested to find out all the systems connected to my LAN...Could any one pls provide some clue about...Thx
First we have to agree on what 'connected' means. If you just mean a piece of wire, it can't be done. If you mean that all the systems are both physically connected and logically connected via IP, and that they're all in the same IP subnet or a limited number of discoverable subnet(s), and that you can determine what the IP subnet is/are, and that they will all respond to ICMP 'ping' or TCP 'echo' requests, or better still a UDP broadcast to each subnet, and that all this will reliably happen at the time you do the query, it's just a matter of iterating over the possible IP addresses in the subnets and calling InetAddress.isReachable(), or sending a UDP broadcast to each subnet's broadcast address and seeing who responds, repeating a few times to take account of possible UDP datagram losses.
In general you can't rely on all these conditions being met. -
I am trying to write a simple Java ping utility. I found some example code on the internet butcan't seem to get it to work. Anyone have any suggestions....
import java.io.*;
import java.net.*;
public class PingTest {
public static void main(String[] args) throws Exception {
String address = "www.yahoo.com";
final int port = 7;
Socket so = new Socket(address, port);
BufferedReader br = new BufferedReader(new InputStreamReader( so.getInputStream() ) );
String timestamp = br.readLine();
System.out.println( address + " is alive at " + timestamp );
} // main method
} // class Ping"ping" requires ICMP, which you can't get at directly from Java. However, if you're using 1.5, you can use the InetAddress.isReachable() API.
The code you've posted is trying to talk to the "echo" server (Port 7), as kind of a "poor man's ping". That'll work if the destination is running echod - which Y! appears NOT to be doing.
Of course, "ping www.yahoo.com" doesn't work either - they're probably blocking ICMP to filter out some standard DDoS attacks.
Grant -
Obtaining originally requested URI for 404 processing, Apache JBoss CF8
Hey all.
The issue I'm facing, in a (rather large) nutshell: when a user requests a directory which doesn't exist, Apache 2.2 forwards the request to JBoss 4.2.3.GA, which loads the 404 template that I've specified in the web.xml file. That happens to be our 404.cfm page which we run under CF8. That's all good. But, we lose all of the info regarding the original request. The script_name and path_translated vars both think that the request was to 404.cfm. Up until now, our application has sent requests for non-existent directories through IIS to JRun and CF, and the original request has been available to us. We've implemented shortcuts in our app which make use of this info, and it's critical that we have it when we rollout our new server. Help, please. :-)
After much research, I've tried two things in Apache: the combo of ErrorDocument and mod_jk, and mod_rewrite.
Below is a synopsis of each approach. If you have another solution, I'd love to hear it. :-)
For the mod_jk approach,I'm doing a LoadModule for mod_jk, and I've added the following in the VirtualHost section of the httpd.conf file:
ErrorDocument 404 /404.cfm
JkMount /(applicationRoot)/* node1
In the mod-jk.conf file, I'm creating environment vars which should get passed on to JBoss.
JkEnvVar REDIRECT_URL undefined
In my 404.cfm template, I'm calling a jsp page with the following code:
<%
if(request.getAttribute("REDIRECT_URL")!=null){
out.println( request.getAttribute("REDIRECT_URL"));
%>
What I get in reponse after requesting a non-existent directory is...nothing. The variable doesn't seem to exist.
This approach apparently works in Railo, where you can use getOriginalRequest() to get at the info you need.
Anyway, going another route, if I instead use mod_rewrite within VirtualHosts and do something like this:
RewriteRule ^(.+)$ /404.cfm?qs=%{REQUEST_URI}?%{QUERY_STRING} [L]
I get sent to the 404, but the code is not proxied to JBoss and instead gets printed to the screen (yikes).
If I do this:
RewriteRule ^(.+)$ http://myserver.domain.com/404.cfm?qs=%{REQUEST_URI}?%{QUERY_STRING} [L]
I get a redirect loop.
If I do this:
RewriteRule ^(.+)$ http://myserver.domain.com:8080/404.cfm?qs=%{REQUEST_URI}?%{QUERY_STRING} [L]
I get sent to the 404 and voilà, I have the variables that I need, but I’m stuck in port 8080 where I don’t want to be.
Finally, if I do this:
RewriteRule /(\d+)\Z /404\.cfm\?qs=$1 [L]
I get rerouted properly, but I lose the original request.
So, at the moment, I'm stuck. Have any of you run across a similar situation? Have a solution? Would love to hear it.
Thanks for reading this far!
SteveYou are saying two servers with identicalconfigration files--JBoss, mod_jk, >Tomcat and
Apache--produce different run-time results?
What I said is that after reinstalling Apache,
copying JBoss/Tomcat & mod_jk2
[from the second instance which still works fine]
and modifying it's config files (IPs, ports, paths,
servernames...)
I still can't make it to work.
Also since it stopped working after power failure,
can it be some corrupted
file or something got screwed up in environment ?
Could be. Though, unless a configuration file was corrupted during the failure (highly dubious), the problem might be hardware related.
The comment you made about going to localhost andgetting a test page >seems to indicate to me that
your Apache directory structure is not being >pointed
to correctly.
Do you mean incorrect is the path to JBoss/Apache?
Or some servername/IP is incorrect ?
Where/what for should I look ?
I was only saying that if you are seeing the Apache test page when you go to that URL, then it should conceptually be possible to look for their default HTML index.html somewhere in your filesystem. Unless there is a caching issue (which a server restart could easily detect), then your configuration is pointing somewhere other than you expect (unless your expectation is to in fact see the default Apache HTTP server home page).
Also, how do I check what is my current localhost
(I have a few in etc/hosts) ?
You can find the server name of your local instance via InetAddress.getLocalHost().getHostName().
TIA,
Oleg.- Saish -
Seeing " Warning The event queue appears to be stuck."
I'm seeing some strange things since I changed to v3.6.1. Could be due to other changes made at roughly the same time but I suspect it's the new jars. I was reading what Patrick wrote here:
http://blackbeanbag.net/wp/2009/07/20/coherence-3-5-service-guardian-deadlock-detection/...and I'm wondering now if my app is just not keeping up with the flow of events...?
Thanks,
Andrew
2010-12-15 14:34:08.609/26.953 Oracle Coherence GE 3.6.1.0 <Info> (thread=AWT-EventQueue-0, member=34): null
2010-12-15 14:34:08.609/26.953 Oracle Coherence GE 3.6.1.0 <Info> (thread=AWT-EventQueue-0, member=34): null
2010-12-15 14:34:08.609/26.953 Oracle Coherence GE 3.6.1.0 <Info> (thread=AWT-EventQueue-0, member=34): null
2010-12-15 14:34:08.609/26.953 Oracle Coherence GE 3.6.1.0 <Info> (thread=AWT-EventQueue-0, member=34): null
2010-12-15 14:34:08.984/27.328 Oracle Coherence GE 3.6.1.0 <Warning> (thread=AWT-EventQueue-0, member=34): The event queue appears to be stuck.
2010-12-15 14:34:08.984/27.328 Oracle Coherence GE 3.6.1.0 <Error> (thread=AWT-EventQueue-0, member=34): Full Thread Dump
Thread[testASocketToServerThread1,5,main]
java.lang.Thread.sleep(Native Method)
testAbook.binary.client.testASocketToServerBinary$1.run(testASocketToServerBinary.java:99)
java.lang.Thread.run(Thread.java:619)
Thread[IpMonitor,6,Cluster]
java.net.Inet4AddressImpl.isReachable0(Native Method)
java.net.Inet4AddressImpl.isReachable(Inet4AddressImpl.java:52)
java.net.InetAddress.isReachable(InetAddress.java:419)
java.net.InetAddress.isReachable(InetAddress.java:378)
com.tangosol.coherence.component.util.daemon.IpMonitor.onNotify(IpMonitor.CDB:12)
com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
java.lang.Thread.run(Thread.java:619)
Thread[threadtestIMsgBase,1,main]
java.lang.Object.wait(Native Method)
java.lang.Object.wait(Object.java:485)
testIbook2.common.testIOrderRepository$1.run(testIOrderRepository.java:54)
java.lang.Thread.run(Thread.java:619)
Thread[AWT-EventQueue-0,6,main]
java.lang.Thread.dumpThreads(Native Method)
java.lang.Thread.getAllStackTraces(Thread.java:1487)
com.tangosol.net.GuardSupport.logStackTraces(GuardSupport.java:810)
com.tangosol.coherence.component.util.daemon.queueProcessor.Service$EventDispatcher.drainOverflow(Service.CDB:45)
com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid$EventDispatcher.drainOverflow(Grid.CDB:9)
com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.post(Grid.CDB:17)
com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$BinaryMap.sendPartitionedRequest(PartitionedCache.CDB:64)
com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$BinaryMap.getAll(PartitionedCache.CDB:12)
com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$BinaryMap$EntryAdvancer.entrySetPage(PartitionedCache.CDB:31)
com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$BinaryMap$EntryAdvancer.nextPage(PartitionedCache.CDB:18)
com.tangosol.util.PagedIterator.hasNext(PagedIterator.java:71)
com.tangosol.util.ConverterCollections$ConverterEntrySet$ConverterIterator.hasNext(ConverterCollections.java:3201)
quoteclient.QuoteClient.addQuoteListener(QuoteClient.java:263)
bbo.RediQuotes.<init>(RediQuotes.java:42)
bbo.RediQuotes.getRediQuotes(RediQuotes.java:18)
bbo.BBOTableRecord.getValue(BBOTableRecord.java:102)
bbo.BBORecordsModel.getValueAt(BBORecordsModel.java:78)
javax.swing.JTable.getValueAt(JTable.java:2685)
javax.swing.JTable.prepareRenderer(JTable.java:5702)
javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:2072)
javax.swing.plaf.basic.BasicTableUI.paintCells(BasicTableUI.java:1974)
javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:1770)
javax.swing.plaf.ComponentUI.update(ComponentUI.java:143)
javax.swing.JComponent.paintComponent(JComponent.java:752)
javax.swing.JComponent.paint(JComponent.java:1029)
javax.swing.JComponent.paintChildren(JComponent.java:862)
javax.swing.JComponent.paint(JComponent.java:1038)
javax.swing.JViewport.paint(JViewport.java:747)
javax.swing.JComponent.paintChildren(JComponent.java:862)
javax.swing.JComponent.paint(JComponent.java:1038)
javax.swing.JComponent.paintToOffscreen(JComponent.java:5124)
javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:278)
javax.swing.RepaintManager.paint(RepaintManager.java:1224)
javax.swing.JComponent._paintImmediately(JComponent.java:5072)
javax.swing.JComponent.paintImmediately(JComponent.java:4882)
javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:785)
javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:713)
javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:693)
javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:125)
java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Thread[Java2D Disposer,10,system]
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134)
sun.java2d.Disposer.run(Disposer.java:125)
java.lang.Thread.run(Thread.java:619)
Thread[PacketListener1P,8,Cluster]
java.net.PlainDatagramSocketImpl.receive0(Native Method)
java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:136)
java.net.DatagramSocket.receive(DatagramSocket.java:712)
com.tangosol.coherence.component.net.socket.UdpSocket.receive(UdpSocket.CDB:22)
com.tangosol.coherence.component.net.UdpPacket.receive(UdpPacket.CDB:1)
com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketListener.onNotify(PacketListener.CDB:20)
com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
java.lang.Thread.run(Thread.java:619)
Thread[autoRetrieveBtNews,6,main]
java.lang.Thread.sleep(Native Method)
testAbook.report.testABookBtNews$1.run(testABookBtNews.java:53)
java.lang.Thread.run(Thread.java:619)
Thread[Signal Dispatcher,9,system]
Thread[D3D Screen Updater,7,system]
java.lang.Object.wait(Native Method)
sun.java2d.d3d.D3DScreenUpdateManager.run(D3DScreenUpdateManager.java:421)
java.lang.Thread.run(Thread.java:619)
Thread[Invocation:Management,6,Cluster]
java.lang.Object.wait(Native Method)
com.tangosol.coherence.component.util.Daemon.onWait(Daemon.CDB:18)
com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onWait(Grid.CDB:6)
com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:39)
java.lang.Thread.run(Thread.java:619)
Thread[AWT-Windows,6,main]
sun.awt.windows.WToolkit.eventLoop(Native Method)
sun.awt.windows.WToolkit.run(WToolkit.java:295)
java.lang.Thread.run(Thread.java:619)
Thread[DistributedCache:DistributedStatsCacheService,6,Cluster]
java.lang.Object.wait(Native Method)
com.tangosol.coherence.component.util.Daemon.onWait(Daemon.CDB:18)
com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onWait(Grid.CDB:6)
com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:39)
java.lang.Thread.run(Thread.java:619)
Thread[testASocketToServerThread2,5,main]
java.net.SocketInputStream.socketRead0(Native Method)
java.net.SocketInputStream.read(SocketInputStream.java:129)
sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)
sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
java.io.InputStreamReader.read(InputStreamReader.java:167)
java.io.BufferedReader.fill(BufferedReader.java:136)
java.io.BufferedReader.read1(BufferedReader.java:187)
java.io.BufferedReader.read(BufferedReader.java:261)
testAbook.binary.client.testASocketToServerBinary$2.run(testASocketToServerBinary.java:167)
java.lang.Thread.run(Thread.java:619)
Thread[PacketReceiver,7,Cluster]
java.lang.Object.wait(Native Method)
com.tangosol.coherence.component.util.Daemon.onWait(Daemon.CDB:18)
com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketReceiver.onWait(PacketReceiver.CDB:2)
com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:39)
java.lang.Thread.run(Thread.java:619)
Thread[PacketPublisher,6,Cluster]
java.lang.Object.wait(Native Method)
com.tangosol.coherence.component.util.Daemon.onWait(Daemon.CDB:18)
com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketPublisher.onWait(PacketPublisher.CDB:2)
com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:39)
java.lang.Thread.run(Thread.java:619)
Thread[Logger@9254847 3.6.1.0,3,main]
java.lang.Integer.toString(Integer.java:308)
java.sql.Timestamp.toString(Timestamp.java:301)
com.tangosol.coherence.component.util.daemon.queueProcessor.Logger.formatParameter(Logger.CDB:13)
com.tangosol.coherence.component.application.console.Coherence$Logger.formatParameter(Coherence.CDB:40)
com.tangosol.coherence.component.util.daemon.queueProcessor.Logger.formatMessage(Logger.CDB:23)
com.tangosol.coherence.component.util.daemon.queueProcessor.Logger.onNotify(Logger.CDB:57)
com.tangosol.coherence.component.application.console.Coherence$Logger.onNotify(Coherence.CDB:4)
com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
java.lang.Thread.run(Thread.java:619)
Thread[DistributedCache:DistributedQuotesCacheService,6,Cluster]
java.lang.Object.wait(Native Method)
com.tangosol.coherence.component.util.Daemon.onWait(Daemon.CDB:18)
com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onWait(Grid.CDB:6)
com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:39)
java.lang.Thread.run(Thread.java:619)
Thread[EventQueue:ContinuousQueryCache{Cache=stats._1_DAY_PERCENT_CHANGED, Filter=AlwaysFilter},5,EventQueue:ContinuousQueryCache{Cache=stats._1_DAY_PERCENT_CHANGED, Filter=AlwaysFilter}]
java.lang.Object.wait(Native Method)
java.lang.Object.wait(Object.java:485)
com.tangosol.util.TaskDaemon.takeNextRipeTask(TaskDaemon.java:345)
com.tangosol.util.TaskDaemon.run(TaskDaemon.java:103)
com.tangosol.util.Daemon$DaemonWorker.run(Daemon.java:781)
java.lang.Thread.run(Thread.java:619)
Thread[PacketListenerN,8,Cluster]
java.net.PlainDatagramSocketImpl.receive0(Native Method)
java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:136)
java.net.DatagramSocket.receive(DatagramSocket.java:712)
com.tangosol.coherence.component.net.socket.UdpSocket.receive(UdpSocket.CDB:22)
com.tangosol.coherence.component.net.UdpPacket.receive(UdpPacket.CDB:1)
com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketListener.onNotify(PacketListener.CDB:20)
com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
java.lang.Thread.run(Thread.java:619)
Thread[Cluster|Member(Id=34, Timestamp=2010-12-15 14:34:28.185, Address=192.168.3.26:8088, MachineId=27418, Location=machine:dab1,process:4020,member:s1, Role=BboBBOClientMain),6,Cluster]
sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method)
sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(WindowsSelectorImpl.java:273)
sun.nio.ch.WindowsSelectorImpl$SubSelector.access$400(WindowsSelectorImpl.java:255)
sun.nio.ch.WindowsSelectorImpl.doSelect(WindowsSelectorImpl.java:136)
sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:69)
sun.nio.ch.SelectorImpl.select(SelectorImpl.java:80)
com.tangosol.coherence.component.net.TcpRing.select(TcpRing.CDB:11)
com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.ClusterService.onWait(ClusterService.CDB:6)
com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:39)
java.lang.Thread.run(Thread.java:619)
Thread[threadAutoRefreshBBO,5,main]
java.lang.Thread.sleep(Native Method)
bbo.BBORecordsModel$1.run(BBORecordsModel.java:152)
java.lang.Thread.run(Thread.java:619)
Thread[PacketListener1,8,Cluster]
java.net.PlainDatagramSocketImpl.receive0(Native Method)
java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:136)
java.net.DatagramSocket.receive(DatagramSocket.java:712)
com.tangosol.coherence.component.net.socket.UdpSocket.receive(UdpSocket.CDB:22)
com.tangosol.coherence.component.net.UdpPacket.receive(UdpPacket.CDB:1)
com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketListener.onNotify(PacketListener.CDB:20)
com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
java.lang.Thread.run(Thread.java:619)
Thread[testAOrderRepositoryBinaryThread,5,main]
java.lang.Object.wait(Native Method)
java.lang.Object.wait(Object.java:485)
testAbook.binary.common.testAOrderRepositoryBinary$1.run(testAOrderRepositoryBinary.java:47)
java.lang.Thread.run(Thread.java:619)
Thread[Reference Handler,10,system]
java.lang.Object.wait(Native Method)
java.lang.Object.wait(Object.java:485)
java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
Thread[Thread-16,5,main]
java.lang.Thread.sleep(Native Method)
bbo.udp.BBOUDPRecords.refreshBBOUDP(BBOUDPRecords.java:299)
bbo.udp.BBOUDPRecordsModel.refreshBBOUDP(BBOUDPRecordsModel.java:90)
bbo.udp.BBOUDPRecordsModel$1.run(BBOUDPRecordsModel.java:107)
java.lang.Thread.run(Thread.java:619)
Thread[testASocketToServerThread3,5,main]
java.net.SocketOutputStream.socketWrite0(Native Method)
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202)
sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:272)
sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:276)
sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:122)
java.io.OutputStreamWriter.flush(OutputStreamWriter.java:212)
java.io.BufferedWriter.flush(BufferedWriter.java:236)
testAbook.binary.client.testASocketToServerBinary$3.run(testASocketToServerBinary.java:248)
java.lang.Thread.run(Thread.java:619)
Thread[Attach Listener,5,system]
Thread[DistributedCache:DistributedQuotesCacheService:EventDispatcher,6,Cluster]
quoteclient.QuoteClient.p(QuoteClient.java:48)
quoteclient.QuoteClient.entryUpdated(QuoteClient.java:95)
com.tangosol.util.MapEvent.dispatch(MapEvent.java:270)
com.tangosol.util.MapEvent.dispatch(MapEvent.java:226)
com.tangosol.util.MapListenerSupport.fireEvent(MapListenerSupport.java:556)
com.tangosol.coherence.component.util.SafeNamedCache.translateMapEvent(SafeNamedCache.CDB:7)
com.tangosol.coherence.component.util.SafeNamedCache.entryUpdated(SafeNamedCache.CDB:1)
com.tangosol.util.MapEvent.dispatch(MapEvent.java:270)
com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$ViewMap$ProxyListener.dispatch(PartitionedCache.CDB:22)
com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$ViewMap$ProxyListener.entryUpdated(PartitionedCache.CDB:1)
com.tangosol.util.MapEvent.dispatch(MapEvent.java:270)
com.tangosol.coherence.component.util.CacheEvent.run(CacheEvent.CDB:18)
com.tangosol.coherence.component.util.daemon.queueProcessor.Service$EventDispatcher.onNotify(Service.CDB:26)
com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
java.lang.Thread.run(Thread.java:619)
Thread[DistributedCache:DistributedStatsCacheService:EventDispatcher,6,Cluster]
java.lang.Object.wait(Native Method)
com.tangosol.coherence.component.util.Daemon.onWait(Daemon.CDB:18)
com.tangosol.coherence.component.util.daemon.queueProcessor.Service$EventDispatcher.onWait(Service.CDB:7)
com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:39)
java.lang.Thread.run(Thread.java:619)
Thread[AWT-Shutdown,5,main]
java.lang.Object.wait(Native Method)
java.lang.Object.wait(Object.java:485)
sun.awt.AWTAutoShutdown.run(AWTAutoShutdown.java:265)
java.lang.Thread.run(Thread.java:619)
Thread[EventQueue:ContinuousQueryCache{Cache=stats.OPEN_PRICE, Filter=AlwaysFilter},5,EventQueue:ContinuousQueryCache{Cache=stats.OPEN_PRICE, Filter=AlwaysFilter}]
java.lang.Object.wait(Native Method)
java.lang.Object.wait(Object.java:485)
com.tangosol.util.TaskDaemon.takeNextRipeTask(TaskDaemon.java:345)
com.tangosol.util.TaskDaemon.run(TaskDaemon.java:103)
com.tangosol.util.Daemon$DaemonWorker.run(Daemon.java:781)
java.lang.Thread.run(Thread.java:619)
Thread[readerThread,6,main]
java.lang.Object.wait(Native Method)
java.util.TimerThread.mainLoop(Timer.java:509)
java.util.TimerThread.run(Timer.java:462)
Thread[Thread-11,5,main]
java.lang.Thread.sleep(Native Method)
testIbook2.client.testIBBOSocketToServer$1.run(testIBBOSocketToServer.java:82)
java.lang.Thread.run(Thread.java:619)
Thread[threadReceive,5,main]
java.net.SocketInputStream.socketRead0(Native Method)
java.net.SocketInputStream.read(SocketInputStream.java:129)
sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)
sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
java.io.InputStreamReader.read(InputStreamReader.java:167)
java.io.BufferedReader.fill(BufferedReader.java:136)
java.io.BufferedReader.readLine(BufferedReader.java:299)
java.io.BufferedReader.readLine(BufferedReader.java:362)
testIbook2.client.testIBBOSocketToServer$2.run(testIBBOSocketToServer.java:171)
java.lang.Thread.run(Thread.java:619)
Thread[main,5,main]
java.awt.Component.resize(Component.java:2045)
java.awt.Component.setSize(Component.java:2035)
java.awt.Window.setSize(Window.java:791)
strategies.layout.LayoutViewer.openLayout(LayoutViewer.java:319)
bbo.BBOClientMain.main(BBOClientMain.java:74)
Thread[TimerQueue,5,system]
java.lang.Object.wait(Native Method)
javax.swing.TimerQueue.run(TimerQueue.java:232)
java.lang.Thread.run(Thread.java:619)
Thread[PacketSpeaker,8,Cluster]
java.lang.Object.wait(Native Method)
com.tangosol.coherence.component.util.queue.ConcurrentQueue.waitForEntry(ConcurrentQueue.CDB:16)
com.tangosol.coherence.component.util.queue.ConcurrentQueue.remove(ConcurrentQueue.CDB:7)
com.tangosol.coherence.component.util.Queue.remove(Queue.CDB:1)
com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketSpeaker.onNotify(PacketSpeaker.CDB:21)
com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
java.lang.Thread.run(Thread.java:619)
Thread[Invocation:Management:EventDispatcher,6,Cluster]
java.lang.Object.wait(Native Method)
com.tangosol.coherence.component.util.Daemon.onWait(Daemon.CDB:18)
com.tangosol.coherence.component.util.daemon.queueProcessor.Service$EventDispatcher.onWait(Service.CDB:7)
com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:39)
java.lang.Thread.run(Thread.java:619)
Thread[Finalizer,8,system]
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134)
java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
2010-12-15 14:34:09.000/27.344 Oracle Coherence GE 3.6.1.0 <Info> (thread=AWT-EventQueue-0, member=34): null
2010-12-15 14:34:09.015/27.359 Oracle Coherence GE 3.6.1.0 <Info> (thread=AWT-EventQueue-0, member=34): null
2010-12-15 14:34:09.015/27.359 Oracle Coherence GE 3.6.1.0 <Info> (thread=AWT-EventQueue-0, member=34): null
2010-12-15 14:34:09.015/27.359 Oracle Coherence GE 3.6.1.0 <Info> (thread=AWT-EventQueue-0, member=34): null
2010-12-15 14:34:09.031/27.375 Oracle Coherence GE 3.6.1.0 <Info> (thread=AWT-EventQueue-0, member=34): null
2010-12-15 14:34:09.046/27.390 Oracle Coherence GE 3.6.1.0 <Info> (thread=AWT-EventQueue-0, member=34): null
2010-12-15 14:34:09.046/27.390 Oracle Coherence GE 3.6.1.0 <Info> (thread=AWT-EventQueue-0, member=34): null
2010-12-15 14:34:12.203/30.547 Oracle Coherence GE 3.6.1.0 <Info> (thread=AWT-EventQueue-0, member=34): null
2010-12-15 14:34:12.218/30.562 Oracle Coherence GE 3.6.1.0 <Info> (thread=AWT-EventQueue-0, member=34): null
2010-12-15 14:34:12.218/30.562 Oracle Coherence GE 3.6.1.0 <Info> (thread=AWT-EventQueue-0, member=34): null
2010-12-15 14:34:12.218/30.562 Oracle Coherence GE 3.6.1.0 <Info> (thread=AWT-EventQueue-0, member=34): null
2010-12-15 14:34:12.218/30.562 Oracle Coherence GE 3.6.1.0 <Info> (thread=AWT-EventQueue-0, member=34): null
2010-12-15 14:34:12.296/30.640 Oracle Coherence GE 3.6.1.0 <Info> (thread=DistributedCache:DistributedQuotesCacheService:EventDispatcher, member=34): null
2010-12-15 14:34:12.296/30.640 Oracle Coherence GE 3.6.1.0 <Info> (thread=DistributedCache:DistributedQuotesCacheService:EventDispatcher, member=34): null
2010-12-15 14:34:12.296/30.640 Oracle Coherence GE 3.6.1.0 <Info> (thread=DistributedCache:DistributedQuotesCacheService:EventDispatcher, member=34): null
2010-12-15 14:34:12.312/30.656 Oracle Coherence GE 3.6.1.0 <Info> (thread=DistributedCache:DistributedQuotesCacheService:EventDispatcher, member=34): nullHi Tarun
Please see the discussion in this thread GuardSupport logging thread dumps without giving a reason
Paul -
UnkownHostException in solaris 10
Hi,
I can not perform nslookups from java programs in my solaris 10 machine as a standard user..
when I execute
InetAddress.getByName("localhost");
I get:
java.net.UnknownHostException: localhost: localhost
at java.net.InetAddress.getAllByName0(InetAddress.java:1128)
at java.net.InetAddress.getAllByName0(InetAddress.java:1098)
at java.net.InetAddress.getAllByName(InetAddress.java:1061)
at java.net.InetAddress.getByName(InetAddress.java:958)
at Local.getName(Local.java:17)
at Local.main(Local.java:56)
The funny thing is that as root the algorithm works perfectly.. As root, everything works fine. So if the problem would be that some java packages were missing, it is fixed.
Another funny thing is that I am able to do it from C programs as a standard user. Moreover, I can perform nslookups through other ways like telnet and web browsing and everithing works fine. (as a common user).
The network connection is correctly installed and I have no problem to run the services and aplications that are not implemented with Java.
I figured out that the problem would come from JAva security manager. I checked it from java.policy configuration file as well as from checking permissions with
try{
// Get the protection domain for the class
domain = Class.forName("Local").getProtectionDomain();
catch(ClassNotFoundException e)
System.out.println("Agur");
return;
// With the protection domain, get all the permissions from the Policy object
PermissionCollection pcoll = Policy.getPolicy().getPermissions(domain);
// View each permission in the permission collection
Enumeration enume = pcoll.elements();
for (; enume.hasMoreElements(); ) {
Permission p = (Permission)enume.nextElement();
System.out.println(p.toString());
and I saw that I have the next line granting the permissions of conecting, accepting and resolving:
(java.net.SocketPermission localhost:1024- connect,listen,accept,resolve)
so it is correct.
Installed java version:
java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
Java HotSpot(TM) Server VM (build 1.5.0_01-b08, mixed mode)
Summarizing:
I can not perform java nslookup (via InetAddress.getByName("localhost");) as a normal user, but I can as root.
The C version works as root and as normal user
The segurity manager of java is correctly configured.
can anyone help me?
Thanks in advance.i didnt however i wasnt hammering it. if the load was expected to be high i would have done the io layout diff (try and follow some of oracles ideas: SAME for one, if possible).
some depends on the load and the load from the other zones. you can use allocate resource limits to give more priority to more important zones or make sure you have enough resources to start. what type of load are you expecting? -
Applets, URLConnection, IPv6, and Cookies
The web application I'm working on does part of its cookie authentication by comparing the REMOTE_ADDR header to your cookie, which works fine for browser interaction. But we have a few applets that communicate directly with the server. In mixed IPv4/IPv6 environments, the browser (naturally) communicates using IPv6, but the Applets use IPv4 by default, causing the REMOTE_ADDR comparison to fail (the server expects an IPv6 address).
I've had mixed results with setting java.net.preferIPv6Addresses to TRUE in my Java settings. This appears to work on my machine, but not on my QA's machine.
I also tried setting this property programmatically and then signing the applet, but that didn't appear to work at all.
The alternative I came up with was to find an IPv6 address via InetAddress.getAllByName(host), and use that for my URL instead of the hostname. This reports the correct IP address in REMOTE_ADDR, but since I'm not using the same name as in the browser, my browser cookies don't come along for the ride. I've tried getting the cookies by opening a connection to the correct hostname and reading connection.getRequestProperties() or connection.getHeaderField("Set-Cookie"), but I don't get any information back.
Does anyone have any ideas as to how I can either
a) Force the applet to connect using the correct IP stack, or
b) Grab the cookie from the browser
Thanks.try
URLConnection.setUseCaches(false)
setUseCaches
public void setUseCaches(boolean usecaches)
Sets the value of the useCaches field of this URLConnection to the specified value.
Some protocols do caching of documents. Occasionally, it is important to be able to "tunnel through" and ignore the caches
(e.g., the "reload" button in a browser). If the UseCaches flag on a connection is true, the connection is allowed to use
whatever caches it can. If false, caches are to be ignored. The default value comes from DefaultUseCaches, which defaults to
true.
or try to delete old cookies by calling Cookie.setMaxAge(0)
in your jsp -
Checking for valid (and working) address
(sorry if i posted in the wrong forum... i didn't found any that suits better my problem)
that's the question: i have a string and need to check if it's a valid host name/ip address and also check if it's up and running at the moment. to solve the host name, i have the following code:
try {
URL url = new URL(sURL);
HttpURLConnection uc = (HttpURLConnection) url.openConnection() ;
uc.setRequestMethod("GET") ;
uc.connect();
uc.getResponseMessage();
catch (IOException ioe) {
//wrong url/not working
but it doesn't work with ip addresses. Someone suggested me to use InetAddress.isReachable(int), but it's only avaliable since Java 1.5, and i must use 1.4. Another way around would be to use InetAddress.get(Canonical)HostName(), but it may fail even with a valid ip address, and i can't allow that.
can someone give me a hand?
thanks!(sorry if i posted in the wrong forum... i didn't
found any that suits better my problem)
that's the question: i have a string and need to
check if it's a valid host name/ip address and also
check if it's up and running at the moment. to solve
the host name, i have the following code:Easy - it isn't possible at all.
If and only if you were to use ICMP (which you can't in 1.4 using just java) and if and only if the target computer responded to ICMP then you could use that.
That is seldom very useful because generally one doesn't care if a computer responds to ICMP. What they need to know is if the computer is actually doing what it is supposed.
For example if you have an http server, what you care about is if it is actually handling http requests. (The computer can be up and not handling http requests.)
Not to mention of course that a host name requires that the DNS server respond to it first. And just because the DNS server is failing it doesn't mean that the target PC is failiing.
But if you really want to do nothing but ICMP then you can use Runtime.exec() and an OS specific command (usually 'ping') to do just that.
Maybe you are looking for
-
Bridge CS6 (Windows 7) Photoshop/Batch menu missing.
I've installed CS6 (CS5 is still on the machine), and in the Bridge Menu, there is no longer a Batch menu item for initiating actions. In Bridge's Edit/Preference command, I have the Startup Scripts checked. There are no files in the "Startup Script
-
Loop in subVI to be stopped by control in calling VI.
I have a loop in a subVI that is supposed to run untill a stop-button is pressed in the calling VI. This doesn't work due to data flow issues. It has coem to my attention that this can be done using references, invoke nodes and/or property nodes. How
-
I have issues syncing my Ipad (version 1 32GB) to my Itunes. Even if I select to sync manually, and have no TV shows selected, I am told that there is no room available on my IPad. So it simply wont sync at all. How do I get my Computer to only trans
-
Why is my fcp 7 serial number says invalid which worked earlier on same machine
my fcp7 worked fine with machine but after updating os it says its invalid help
-
Dynamic Selections - FBL5n transaction
Hi all, How can we add a new field on the "Dynamic Selections" in FBL5n transaction? Thanks