Skip to content
Snippets Groups Projects
LandasClient1.java 1.40 KiB
/*
 * 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 mv3500_assignments;

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");
        
        }
        
    }
    
}