私は2つのApacheサーバーを持っています。1 つの apache サーバーが実行されています。別の Apache が実行されていません。実行中の apche から、2 番目の Apache が実行されているかどうかを確認する方法は? 私はjspコードが欲しい..
1 に答える
2
ソケットを介してApacheサーバーに接続したいのかもしれません。
<%@ page contentType="text/html" import="java.io.*, java.net.*" %>
<%
try {
Socket s = new Socket("another.apache.com", 80);
BufferedReader in = new BufferedReader(new
InputStreamReader(s.getInputStream()));
PrintWriter socketOut = new PrintWriter(s.getOutputStream());
socketOut.print("GET /index.html\n\n");
socketOut.flush();
String line;
while ((line = in.readLine()) != null){
out.println(line);
}
} catch (Exception e){}
%>
例外がない場合は、別の apache サーバーが実行されています。それ以外の場合はオフラインです。
于 2013-03-15T05:25:26.487 に答える