Ejemplo n.º 1
0
 /// <summary>
 /// 初始化代理
 /// </summary>
 /// <param name="port"></param>
 public PhpCgiServerProxy(PhpArchive archive, short port = 9000)
 {
     Port       = port;
     IsActive   = false;
     Listener   = new TcpListener(IPAddress.Any, Port);
     Dispatcher = new PhpCgiProcessDispatcher(archive);
 }
Ejemplo n.º 2
0
 public PhpCgiProcessDispatcher(PhpArchive archive)
 {
     Archive         = archive;
     processes       = new List <PhpCgiProcess>();
     ticker          = new System.Timers.Timer();
     ticker.Elapsed += (sender, args) =>
     {
         try
         {
             lock (processes)
             {
                 PhpCgiProcess[] trash = processes.Where(p => p.IsRecyclable).ToArray();
                 processes = processes.Where(p => !trash.Contains(p)).ToList();
                 foreach (PhpCgiProcess process in trash)
                 {
                     process.Stop();
                 }
             }
         }
         catch (Exception e)
         {
             e.ToString().Log();
         }
     };
     ticker.Interval = 10000;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 服务初始化
 /// </summary>
 public PhpCgiService()
 {
     "PHP-CGI Server Initialize =======================================*".Log();
     archive = new PhpArchive("https://windows.php.net/downloads/releases/php-8.0.6-nts-Win32-vs16-x64.zip");
     archive.ArchiveCompleted += new ArchiveCompletedEventHandler(Ready);
     proxy = new PhpCgiServerProxy(archive);
 }
Ejemplo n.º 4
0
 private void serviceInstaller_AfterUninstall(object sender, InstallEventArgs e)
 {
     PhpArchive.UninstallAll();
 }