コード例 #1
0
ファイル: IpcServer.cs プロジェクト: odeheurles/CSNamedPipes
    public static void Main(string [] args)
    {
        // To configure this application to run as a service, run these commands as an admin:
        // sc create SERVICE_NAME type= own start= auto binPath= "FULL_PATH_TO_EXE\IpcServer.exe /service"
        // sc failure SERVICE_NAME reset= 86400 actions= restart/60000/restart/60000/restart/60000
        // sc start SERVICE_NAME
        //
        // Other useful commands
        // sc stop SERVICE_NAME
        // sc delete SERVICE_NAME

        if (args.Length > 0 && args[0] == "/service") {
            // Run as a service application
            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[] { new DemoService() };
            ServiceBase.Run(ServicesToRun);
        }
        else {
            // Run as a Windows console application
            DemoIpcServer m_server = new DemoIpcServer();
            m_server.Start();

            // Since all the requests are issued asynchronously, the constructors are likely to return
            // before all the requests are complete. The call below stops the application from terminating
            // until we see all the responses displayed.
            Thread.Sleep(1000);
            Console.WriteLine("\nPress return to shutdown server");
            Console.ReadLine();

            m_server.Stop();

            Console.WriteLine("\nComplete! Press return to exit program");
            Console.ReadLine();
        }
    }
コード例 #2
0
ファイル: IpcServer.cs プロジェクト: reyaleman/CSNamedPipes
    public static void Main(string [] args)
    {
        // To configure this application to run as a service, run these commands as an admin:
        // sc create SERVICE_NAME type= own start= auto binPath= "FULL_PATH_TO_EXE\IpcServer.exe /service"
        // sc failure SERVICE_NAME reset= 86400 actions= restart/60000/restart/60000/restart/60000
        // sc start SERVICE_NAME
        //
        // Other useful commands
        // sc stop SERVICE_NAME
        // sc delete SERVICE_NAME


        if (args.Length > 0 && args[0] == "/service")
        {
            // Run as a service application
            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[] { new DemoService() };
            ServiceBase.Run(ServicesToRun);
        }
        else
        {
            // Run as a Windows console application
            DemoIpcServer m_server = new DemoIpcServer();
            m_server.Start();

            // Since all the requests are issued asynchronously, the constructors are likely to return
            // before all the requests are complete. The call below stops the application from terminating
            // until we see all the responses displayed.
            Thread.Sleep(1000);
            Console.WriteLine("\nPress return to shutdown server");
            Console.ReadLine();

            m_server.Stop();

            Console.WriteLine("\nComplete! Press return to exit program");
            Console.ReadLine();
        }
    }
コード例 #3
0
ファイル: IpcServer.cs プロジェクト: reyaleman/CSNamedPipes
 public DemoService()
 {
     m_server = new DemoIpcServer();
 }
コード例 #4
0
ファイル: IpcServer.cs プロジェクト: odeheurles/CSNamedPipes
 public DemoService()
 {
     m_server = new DemoIpcServer();
 }