1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
   | public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
    String          reponse;
    Socket          leSocket;
    PrintStream     fluxSortieSocket;
    BufferedReader  fluxEntreeSocket;
 
    try {
 
        leSocket = new Socket("10.247.111.244",23);
        principal.outstr("vous etes connecte sur le switch "+ leSocket +"",false);
 
        fluxSortieSocket = new PrintStream(leSocket.getOutputStream());
 
        fluxEntreeSocket = new BufferedReader(new  InputStreamReader(leSocket.getInputStream()));
        reponse = fluxEntreeSocket.readLine();
 
        principal.outstr(" Reponse du serveur : " + reponse+"",false);
        leSocket.close();
 
    } catch (UnknownHostException ex) {
        System.err.println("Machine inconnue : "+ex);
        ex.printStackTrace();
    } catch (IOException ex) {
        System.err.println("Erreur : "+ex);
        ex.printStackTrace();
    }
}
 
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
    doGet(request, response);
} | 
Partager