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

public class HandShakeC {
    static Socket client_socket;
    static  PrintWriter    out;
    static Scanner  in;
    public static void main(String args[]) {
        int i=0;
        try {
            int ClientPort=Integer.parseInt("5011");
            InetAddress ip = InetAddress.getByName("localhost");
            client_socket = new Socket(ip, ClientPort);
            out =new PrintWriter(client_socket.getOutputStream(), true);
            in = new Scanner(client_socket.getInputStream());
            System.out.println("The Inet address is "+ip+
                               "\nClient listening on port "+client_socket.getLocalPort()+
                               "\n sending on port "+client_socket.getPort()+"\n\n");
            System.out.println(new Date(System.currentTimeMillis()).toString());
            out.println("Hello Server");
            String the_response="";
            try {
                System.out.println(in.nextLine());
            } catch (Exception e) {
                System.out.println(e);
            }
            System.out.println(new Date(System.currentTimeMillis()).toString());
            return;
        } catch (Exception e) {
            System.out.println(e);
        }
    }
}