import java.io.*; import java.net.*; public class Teade3{ public static void main(String argumendid[]) throws IOException{ ServerSocket ss=new ServerSocket(3001); while(true){ new Teate3loim(ss.accept()); } } } class Teate3loim extends Thread{ Socket sc; public Teate3loim(Socket uus_sc){ sc=uus_sc; start(); } public void run(){ try{ PrintWriter valja=new PrintWriter(sc.getOutputStream(), true); BufferedReader sisse=new BufferedReader( new InputStreamReader(sc.getInputStream()) ); valja.println("Mis su nimi on?"); String nimi=sisse.readLine(); if(nimi.equals("Mari")){ valja.println("Tule homme minu juurde!"); } else{ valja.println("Mind pole homme kodus."); } sc.close(); }catch(Exception e){ System.out.println("Probleem: "+e); } } }