/*
<HTML>
<HEAD>
<TITLE>InetAddress Test Page</TITLE>
<%@ page import="java.net.*" %>
</HEAD>
<BODY>
Localhost: <%= InetAddress.getLocalHost() %> <% out.flush(); %><BR>
localhost: <%= InetAddress.getByName("localhost") %> <% out.flush(); %><BR>
spitsrvr: <%= InetAddress.getByName("spitsrvr") %> <% out.flush(); %><BR>
devtech: <%= InetAddress.getByName("devtech") %> <% out.flush(); %><BR>
naturgraphia: <%= InetAddress.getByName("naturgraphia") %> <% out.flush(); %><BR>
</BODY>
</HTML>
*/

//javac -classpath /jdk1.1.8/lib/classes.zip;/javax/servlet.jar inet_test.java
//java -classpath /jdk1.1.8/lib/classes.zip;/javax/servlet.jar;.; inet_test
//javac -classpath /jdk1.1.8/lib/classes.zip;/javax/servlet.jar inet_test.java & java -classpath /jdk1.1.8/lib/classes.zip;/javax/servlet.jar;.; inet_test

import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class inet_test extends HttpServlet
{
	public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
	{
		res.setContentType("text/html");
		ServletOutputStream out = res.getOutputStream();

		out.println("<html>");
		out.println("<head><title>Snoop Servlet</title></head>");
		out.println("<body<pre>>");

		try
		{
			out.println("Localhost: " + InetAddress.getLocalHost());
//                        InetAddress ia = InetAddress.getByName("localhost");
//			out.println("'localhost': " + ia);
			out.println("'dehua': " + InetAddress.getByName("dehua"));
			out.println("'java': " + InetAddress.getByName("java"));
			out.println("'data': " + InetAddress.getByName("data"));
		}
		catch (UnknownHostException e)
		{
			out.flush();
			out.println(e.toString());
		}
		finally
		{
			out.println("</pre></body></html>");
			out.flush();
		}
	}
			
	public static void main(String[] args)
	{
		try
		{
			System.err.println("Localhost: " + InetAddress.getLocalHost());
			System.err.println("'localhost': " + InetAddress.getByName("localhost"));
			System.err.println("'dehua': " + InetAddress.getByName("dehua"));
			System.err.println("'java': " + InetAddress.getByName("java"));
			System.err.println("'data': " + InetAddress.getByName("data"));
		}
		catch (UnknownHostException e)
		{
			System.err.println(e);
		}
	}
}
