Code example for Socket

Methods: close, getInputStream, getOutputStream

0
    } 
 
    @Override 
    public void run() { 
        try { 
            PrintWriter out = new PrintWriter(cliente.getOutputStream(), true);
            BufferedReader in = new BufferedReader(new InputStreamReader(cliente.getInputStream()));
 
            out.println("SERVIDOR PROFESOR: Bienvenido, ¿Cómo te llamas? ");
 
            String resp2 = in.readLine();
            System.out.println(resp2+" "+new Date());
            in.close();
            out.close();
            cliente.close();
 
        } catch (Exception e) {
            System.out.println("Error : " + e.getMessage());
            e.printStackTrace();
        }