import java.net.*; import java.io.*; public class Vorgusuhtlus implements Runnable{ Socket sc; public Vorgusuhtlus(Socket sc){ this.sc=sc; new Thread(this).start(); } public void run(){ try{ BufferedReader sisse=new BufferedReader( new InputStreamReader(sc.getInputStream())); PrintWriter valja=new PrintWriter(sc.getOutputStream(), true); valja.println("Palun eesnimi:"); String eesnimi=sisse.readLine(); valja.println("Tere, "+eesnimi); sc.close(); } catch(Exception ex){ System.out.println(ex.getMessage()); } } }