import java.net.*; import java.io.*; public class Server{ PrintWriter valja1; PrintWriter valja2; BufferedReader sisse1; BufferedReader sisse2; public Server(){ try{ServerSocket ss= new ServerSocket(3001); while(true){ Socket sc1=ss.accept(); valja1=new PrintWriter(sc1.getOutputStream(), true); sisse1=new BufferedReader(new InputStreamReader(sc1.getInputStream())); Socket sc2=ss.accept(); valja2=new PrintWriter(sc2.getOutputStream(), true); sisse2=new BufferedReader(new InputStreamReader(sc2.getInputStream())); while(true){ String rida1=sisse1.readLine(); valja2.println(rida1); System.out.println(rida1); // String rida2=sisse2.readLine(); // valja1.println(rida2); } } }catch(IOException e){ System.out.println("Viga "+e); } } public static void main(String args[]){ new Server(); } }