public static void main(String[] args) throws IOException {

    String serverIp = "localhost";
    System.out.println("Welcome to Client side");

    Socket fromserver = null;

    /*
    if (args.length==0) {
      System.out.println("use: client hostname");
      System.exit(-1);
    }
    * */

    System.out.println("Connecting to... "+serverIp);

    fromserver = new Socket(serverIp,4444);
    BufferedReader in  = new
     BufferedReader(new 
      InputStreamReader(fromserver.getInputStream()));
    PrintWriter    out = new 
     PrintWriter(fromserver.getOutputStream(),true);


    String fuser,fserver;

    while (true) {
      fserver = in.readLine();
      System.out.println(fserver);
      if(0>1)
          break;
    }

    out.close();
    in.close();
    fromserver.close();
  }