import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.ServerSocket; import java.net.Socket; /* * Created on 28 oct. 2004 */ public class SecureServer implements Runnable{ public static void main(String[] args) { new Thread( new SecureServer()).start(); } public void run(){ CommonSocketFactory csf = new CommonSocketFactory(); ServerSocket ss = null; try{ ss=csf.createServerSocket(true); listen(ss); } catch (Exception e){ System.out.println(e); } } void listen(ServerSocket ss){ System.out.println("Socket serveur: "+ss); try{ System.out.println("Serveur pret pour les demandes de connection"); while (true){ Socket s = ss.accept(); System.out.println("Connexion acceptee "+s); BufferedReader br = new BufferedReader( new InputStreamReader(s.getInputStream())); System.out.println("Message recu:"+br.readLine()); } } catch (Exception e){ System.out.println(e); } } }