import java.io.*; import java.net.*; import java.util.*; public class Pisike{ public static void main(String argumendid[]) throws IOException{ int nr=1; Vector uhendused=new Vector(); ServerSocket ss=new ServerSocket(3001); while(true){ Socket sc=ss.accept(); uhendused.add(sc); new Pisikeloim(sc, nr, uhendused); nr++; } } } class Pisikeloim extends Thread{ Socket sc; Vector v; int nr; public Pisikeloim(Socket uus_sc, int uus_nr, Vector t){ v=t; sc=uus_sc; nr=uus_nr; start(); } public void run(){ try{ PrintWriter valja=new PrintWriter(sc.getOutputStream(), true); BufferedReader sisse=new BufferedReader( new InputStreamReader(sc.getInputStream()) ); valja.println( " _ \n"+ " _.-~~.) \n"+ " _.--~~~~~---....__ .' . .,' \n"+ " ,'. . . . . . . . . .~- ._ ( \n"+ " ( .. .g. . . . . . . . . . .~-._ \n"+ " .~__.-~ ~`. . . . . . . . . . . -. \n"+ " `----..._ ~-=~~-. . . . . . . . ~-. \n"+ " ~-._ `-._ ~=_~~--. . . . . .~. \n"+ " | .~-.._ ~--._-. ~-. . . . ~-. \n"+ " \\ .( ~~--.._~' `. . . . .~-. , \n"+ " `._\\ ~~--.._ `. . . . . ~-. .- . ,'/ \n"+ " _ . _ . -~\\ _ .. _ ~~--.`_. . . . . ~-_ ,-','` . \n"+ " ` ._ ~ ~--. . . . .~=.-'. /. ` \n"+ " - . -~ -. _ . - ~ - _ - ~ ~--..__~ _,. / \\ - ~ \n"+ " . __ .. ~- ~~_. ( ` \n"+ " )`. _ _ `- .. - . . - ~ ~ . \\ ~-` ` ` `. _ \n"+ " _ _ - . ` . \\ \\ `. \n"); valja.println("Mis su nimi on?"); String nimi=sisse.readLine(); valja.println("Anna password?:"); String passwd=sisse.readLine(); if(nimi.equals("Rain") && passwd.equals("laptop")) { valja.println("Edukas sisselogimine"); } else{ valja.println("Kahjuks sisselogimine ebaõnnestus"); sc.close(); System.out.println("Vigane meldimine"); throw new Exception("Vigane parool"); } valja.println("Tere külaline " +nimi+ " masinast " +sc.getInetAddress()+" , sinu järjekorra number on " +nr); PrintWriter kirjuta=new PrintWriter( new FileWriter(nimi+ ".txt")); kirjuta.println("Külalise nimi: "+nimi+"\r\n"+ "Külaline oli sisse logitud masinast: "+sc.getInetAddress()+"\r\n"+ "Aeg oli: " +new Date()); kirjuta.close(); String valju; do { System.out.println("Uus ring"); valju=sisse.readLine(); for(int i=0; i