How to check if Glassfish DAS is running programmatically even if it is deployed on local machine or remote machine?
Using Java6
You can use socket
to check if your connection up or not :
i use this way this work with me:
private boolean checkConnection(String host, int port) {
try {
Socket socket = new Socket(host, port);
socket.close();
return true;
} catch (IOException e) {
e.printStackTrace();
return false;
}
}
If the socket is created then the connection is up, else the connection is down.