// See http://blog.lolyco.com/sean/2008/06/17/whats-my-ip-address/
import java.net.Socket;
import java.net.ServerSocket;

import java.util.Date;

public class IPEcho
{
	public static void main(String[] args) throws Exception
	{
		ServerSocket ss = new ServerSocket(4447);
		while (true)
		{
			Socket s = ss.accept();
			String IP = s.getInetAddress().getHostAddress();
			System.out.println(new Date() + "=" + IP);
			s.getOutputStream().write(IP.getBytes());
			s.close();
		}
	}
}
