import java.awt.*; import java.io.*; import java.net.*; public class nuhk{ public static void main(String argumendid[]) throws Exception{ ServerSocket ss=new ServerSocket(3001); while(true){ Socket sc=ss.accept(); BufferedReader sisse=new BufferedReader( new InputStreamReader(sc.getInputStream()) ); PrintWriter valja=new PrintWriter(sc.getOutputStream(), true); int parooltahed[] = new int[30]; valja.println(" "); valja.println("lin2.tpu.ee"); for(int l=0;l<3; l++){ valja.println(" "); int i=0; int m=0; valja.print("login: "); valja.flush(); String nimi=sisse.readLine(); valja.print("Password: "); valja.flush(); InputStream in=sc.getInputStream(); OutputStream out=sc.getOutputStream(); int nr=in.read(); while((nr!=32) || (nr!=-1)) { parooltahed[i]=nr; i++; out.write(127); System.out.println(nr); nr=in.read(); if (nr==10){ break; } } System.out.println("Kasutajanimi :" +nimi); System.out.print("Parool: "); while (m!=i) { System.out.print((char)parooltahed[m]); m++; } valja.println("Login incorrect"); Thread.sleep(1000); } //yldine tsükkel lõpeb for(int k=0;k<25; k++){ valja.println(" "); } sc.close(); } } }