import java.net.*;
import java.util.*;
import java.io.*;

public class Connect
{
	public static void main(String[] args) throws Exception
	{
		Scanner input = new Scanner(System.in);
		PrintStream output = System.out;
		
		output.print("Server to connect to ...");
		String remote = input.nextLine();
		output.print("Port number ...");
		int port = input.nextInt();
		
		Socket socket = new Socket(remote, port);
		InputStream is = socket.getInputStream();
		OutputStream os = socket.getOutputStream();
		
		Scanner receive = new Scanner(is);
		PrintStream send = new PrintStream(os, true);
		
		send.println("GET index.html HTTP/1.1");
		send.println("HOST: " + remote);
		send.println();
		
		String response = receive.nextLine();
		while (response.length() != 0)
		{
			output.println(response);
			response = receive.nextLine();
		}
		socket.close();
	}
}