import java.io.*; import java.net.*; public class Server { public static void main(String argumendid[]) throws IOException{ int nr, korrad; String nimi, rida; ServerSocket ss=new ServerSocket(3000); while(true) { Socket sc=ss.accept(); System.out.println("keski tahab"); PrintWriter valja=new PrintWriter(sc.getOutputStream(), true); BufferedReader sisse=new BufferedReader(new InputStreamReader(sc.getInputStream())); rida=sisse.readLine(); nr = rida.indexOf("---"); korrad = Integer.parseInt(rida.substring(0, nr)); nimi = rida.substring(nr+3, rida.length()); PrintWriter faili=new PrintWriter(new FileWriter("kohad.txt", true)); faili.println(rida); faili.close(); BufferedReader failist=new BufferedReader(new FileReader("kohad.txt")); rida=failist.readLine(); while(rida!=null){ valja.println(rida); rida=failist.readLine(); } failist.close(); sc.close(); } } }