Test connectivity cheat-sheet
You can do any of these tests on an openaf-console (e.g. ./oafc or ./openaf-console)
Pure network tests
Test | Command | Results |
Test port | ow.loadNet().testPort("some.host", 12345) | if false the host couldn’t be reached. true |
Test port with timeout | ow.loadNet().testPort("some.host", 12345, 15000) | if false the host couldn’t be reached. true otherwise |
Test host (ping) | ow.loadNet().testHost("127.0.0.1") | { time: 0, reachable: true } |
Test port latency (socket) | ow.loadNet().testPortLatency("1.1.1.1", 443) | 3 |
Test URL latency | ow.loadNet().testURLLatency("https://google.com") | 118 |
Get IP address from hostname | ow.loadNet().getHost2IP("one.one.one.one") | 1.1.1.1 |
Get hostname from IP address | ow.loadNet().getIP2Host("1.1.1.1") | one.one.one.one |
Test a port with an IPv6 address | ow.loadNet().testPort("[2001:4860:4860:0:0:0:0:8888]", 443) | if false the host couldn’t be reached. true |
DNS checks
Test | Command | Results |
Check the IPv4 results of a DNS query | ow.loadNet().getDNS("dns.google", "A") | You should get an array of results. |
Check the IPv6 results of a DNS query | ow.loadNet().getDNS("dns.google", "AAAA") | You should get an array of results. |
For more IPv6 options see Prefer IPv6 over IPv4
Database connection tests
Test | Command | Results |
Test connecting to a PostgreSQL database | (new DB("jdbc:postgresql://hh-pgsql-public.ebi.ac.uk:5432/pfmegrnargs", "reader", "NWDMCE5xdipIjRrp")).q("select 2+2 a") | {“results”:[{“a”:4}]} |
Test connecting to an Oracle database | (new DB("jdbc:oracle:thin:@myhost:1521:orcl", "scott", "tiger")).q("select 2+2 a from dual") | {“results”:[{“A”:4}]} |