import java.net.*; import java.io.*; import java.lang.String; import java.applet.Applet; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.*; public class info{ public static void main(String argumendid[]) throws IOException{ 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()) ); System.out.println("Palun failinimi:"); String failinimi=sisse.readLine(); File f=new File(failinimi); if(f.exists()){ // System.out.println(f); PrintWriter valja1=new PrintWriter(sc.getOutputStream(), true); BufferedReader sisse1=new BufferedReader( new FileReader(failinimi) ); String t=sisse1.readLine(); while(t!=null){ valja1.println(t); t=t+1; t=sisse1.readLine(); } // t++; } else{ PrintWriter valja1=new PrintWriter(sc.getOutputStream(), true); valja1.println("Sellist faili ei leidu"); } sc.close(); } } }