Flux.Server.Start C# (CSharp) Method

Start() public method

public Start ( System.Func,System.Threading.Tasks.Task> app ) : void
app System.Func,System.Threading.Tasks.Task>
return void
        public void Start(AppFunc app)
        {
            if (1 != Interlocked.Increment(ref _started)) throw new InvalidOperationException("Server is already started.");

            _app = app;
            _listener.Start();
            _listener.BeginAcceptSocket(Callback, null);
        }

Usage Example

Esempio n. 1
0
        static void Main(string[] args)
        {
            using (var server = new Server(8080))
            {
                server.Start(WebApp.App(new GmcJobList()));

                Console.WriteLine("Running server");
                Console.WriteLine("Press enter to exit");
                Console.ReadLine();

                server.Stop();
            }
        }