コード例 #1
0
    private static async Task MainAsync(string[] args)
    {
        Process php = new Process();

        php.StartInfo.FileName = appdata + @"php\php.exe";
        if (File.Exists(appdata + "Web\\ip.txt"))
        {
            php.StartInfo.Arguments = "-S 0.0.0.0:8080 -t \"" + appdata + "Web\"";
        }
        else
        {
            php.StartInfo.Arguments = "-S 127.0.0.1:8080 -t \"" + appdata + "Web\"";
        }
        php.Start();

        var tcs    = new TaskCompletionSource <object>();
        var server = new AsyncHttpServer(portNumber: 8080);
        //var task = Task.Run(() => server.Start());

        await Console.Out.WriteLineAsync("Listening on port 8080");

        checkDriver("VID_1781&PID_0C9F");
        //checkDriver("VID_16C0&PID_05DC");

        await tcs.Task;
        await server.Stop();
    }
コード例 #2
0
		static void Main(string[] args)
		{
			var server = new AsyncHttpServer(portNumber: 1234);
			var t = Task.Run(() => server.Start());
			Console.WriteLine("Listening on port 1234. Open http://localhost:1234 in your browser.");
			Console.WriteLine("Trying to connect:");
			Console.WriteLine();

			GetResponseAsync("http://localhost:1234").GetAwaiter().GetResult();

			Console.WriteLine();
			Console.WriteLine("Press Enter to stop the server.");
			Console.ReadLine();

			server.Stop().GetAwaiter().GetResult();
		}
コード例 #3
0
ファイル: Program.cs プロジェクト: a532367171/ThreadStudent
        static void Main(string[] args)
        {
            var server = new AsyncHttpServer(1234);
            var t      = Task.Run(() => server.Start());

            WriteLine("Listening on port 1234. Open http://localhost:1234 in your browser.");
            WriteLine("Trying to connect:");
            WriteLine();

            GetResponseAsync("http://localhost:1234").GetAwaiter().GetResult();

            WriteLine();
            WriteLine("Press Enter to stop the server.");
            ReadLine();

            server.Stop().GetAwaiter().GetResult();
        }
コード例 #4
0
        public override void Run()
        {
            var server = new AsyncHttpServer(1234);
            var t      = Task.Run(() => server.Start());

            Console.WriteLine("Listening on port 1234. http://localhost:1234 in your browser.");
            Console.WriteLine("Trying to connect:");
            Console.WriteLine();

            GetResponseAsync("http://localhost:1234").GetAwaiter().GetResult();

            Console.WriteLine();
            Console.WriteLine("Press Enter to stop the server.");
            Console.ReadLine();

            server.Stop().GetAwaiter().GetResult();
        }
コード例 #5
0
 public void TearDown()
 {
     server.Stop();
 }
コード例 #6
0
 public void Stop()
 {
     server.Stop();
     server.Dispose();
 }