VMware Cloud Community
qc4vmware
Virtuoso
Virtuoso

System.isHostReachable not always returning true when hosts are pingable

I am trying to use the System.isHostReachable method and it seems to be working for some ip addreses and hostnames but others it is failing.  I have connected to the vco host and I am able to ping the failing addresses successfully from the command prompt.  Is there some limitation to what the System call can see or do I need to tweak something in the configuration?

0 Kudos
3 Replies
iiliev
VMware Employee
VMware Employee

There is no limitations to what this system call can see.

Scripting call

System.isHostReachable(hostOrIp, timeout);

is equivalent to this standard Java call

InetAddress.getByName(hostOrIp).isReachable(timeout);

My suggestion is to try to increase timeout parameter from its default value 1000 milliseconds to a larger value, for example 3000 milliseconds.

-Ilian

0 Kudos
DDinu
Enthusiast
Enthusiast

Sorry to bring back the old one.

Am having the same issue to.

  1. System.isHostReachable('x.x.x.x', 3000);  - Always returns false even if the host is reachable
  2. InetAddress.getByName(x.x.x.x).isReachable(3000); - ReferenceError: "InetAddress" is not defined. (Workflow:Test / Scriptable task (item1)#60)

0 Kudos
qc4vmware
Virtuoso
Virtuoso

What I ended up doing is writing an action that does a ping test specifically first.  If that doesn't return true it runs a System.isHostReachable.  isHostReachable attempts a tcp connect so in some cases one test will fail.  If either works I return true.

Paul

0 Kudos