/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package MV3500Cohort2018JanuaryMarch.homework1; import java.io.*; import java.net.*; /** * * @author Rico */ public class LandasClient1 { /** * @param args the command line arguments */ public static void main(String[] args) { try { System.out.println("Creating Socket"); Socket cs = new Socket("localhost", 2317); while (true) { PrintStream cp = new PrintStream(cs.getOutputStream()); System.out.print("\nClient: \n"); System.out.print("Please enter entity identifier and position: "); InputStreamReader cir = new InputStreamReader(System.in); BufferedReader cbr = new BufferedReader(cir); String temp1 = cbr.readLine(); cp.println(temp1); BufferedReader cbr1 = new BufferedReader(new InputStreamReader(cs.getInputStream())); String temp2 = cbr1.readLine(); System.out.print(temp2); } } catch(Exception e) { System.out.println(e); System.out.println(" Problem with client"); } } }