Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
FVHTTP Server - Main.java

Main.java

Caricato da: Fraioveio
Scarica il programma completo

  1. package fvhttpserver;
  2.  
  3. import java.io.IOException;
  4. import javax.swing.UIManager;
  5.  
  6. public class Main {
  7.     public static ServerFrame s;
  8.     public static ServerAscoltoThread ascT;
  9.     public static String basedir;
  10.     public static ClientConnection[] conn = new ClientConnection[1000];
  11.    
  12.     public static void main(String[] args) throws Exception {
  13.         basedir = Impostazioni.getImpostazioni().basedir;
  14.         UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  15.        
  16.         s = new ServerFrame();
  17.        
  18.         s.setVisible(true);
  19.        
  20.         Thread.sleep(1000);
  21.        
  22.         startServer();
  23.     }
  24.    
  25.     public static void startServer() {
  26.         s.log.setText("");
  27.         ascT = new ServerAscoltoThread(Impostazioni.getImpostazioni().port);
  28.         ascT.start();
  29.         s.online();
  30.     }
  31.    
  32.     public static void stopServer() {
  33.         ascT.stopServer();
  34.         try {
  35.             ascT.ss.close();
  36.         } catch (IOException ex) {}
  37.        
  38.         for(int i=0;i<conn.length;i++) {
  39.             if(conn[i] != null) {
  40.                 conn[i].finish = true;
  41.                 try {
  42.                     Thread.sleep(50);
  43.                 } catch (InterruptedException ex) {}
  44.                 conn[i] = null;
  45.             }
  46.         }
  47.        
  48.         s.offline();
  49.     }
  50. }