import java.io.*; import java.net.*; public class failid{ public static void main(String argumendid[]) throws Exception{ ServerSocket ss=new ServerSocket(3001); while(true){ Socket sc=ss.accept(); PrintWriter valja=new PrintWriter(sc.getOutputStream(), true); BufferedReader sisse=new BufferedReader( new InputStreamReader(sc.getInputStream())); valja.println("Mis faili soovid lugeda? Sisesta faili nimi"); String fail=sisse.readLine(); File failike=new File(fail); if(!(failike.exists())){ valja.println("Antud fail ei eksisteeri"); sc.close(); } else{ BufferedReader teated=new BufferedReader( new FileReader(fail)); String loerida=teated.readLine(); while(loerida!=null){ valja.println(loerida); loerida=teated.readLine(); } teated.close(); sc.close(); } } } }