package socket01;


import java.io.*;
import java.net.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.Socket;

public class client {	
	
   public static void main(String args[]) 
   {

	  
	   
	   try {
    	  
    	  
    	  //Socket socket = new Socket(host,serverPort); 
         
    	  Socket skt = new Socket("82.234.53.234", 8081);
    	  
    	  // envoi un message
    	 // PrintWriter out = new PrintWriter (skt.getOutputStream(), true);
   	     // out.println ("Hello from JAVA TCP Client");
    	  
    	 
   	      
   	   BufferedReader br = new BufferedReader(new InputStreamReader(skt.getInputStream()));

       PrintWriter pw = new PrintWriter(skt.getOutputStream(), true);

       pw.println("Tu me recois serveur ...");
   	      
         // recevoir des datas
       BufferedReader in = new BufferedReader(new InputStreamReader(skt.getInputStream()));
         //System.out.print("Received string: '");

         while (!in.ready()) {}
         System.out.println(in.readLine()); // Read one line and output it

         System.out.print("'\n");
         in.close();
      }
      catch(Exception e) {
         System.out.print("Whoops! It didn't work!\n");
      }
   }
}