コード例 #1
0
        public void Init()
        {
            _httpsv = new HttpServer(4649);
            //_httpsv.Sweeped = false;
            //_httpsv.AddWebSocketService<Echo>("/Echo");
            _httpsv.AddWebSocketService <KinectService>("/");

            _httpsv.OnGet += (sender, e) =>
            {
                onGet(e);
            };

            _httpsv.OnError += (sender, e) =>
            {
                write(e.Message);
            };

            _httpsv.Start();
            write(String.Format("HTTP Server listening on port: {0} service path:", _httpsv.Port));
            foreach (var path in _httpsv.ServicePaths)
            {
                write(String.Format("  {0}", path));
            }
            write("");

            write("Press any key to stop server...");
            //Console.ReadLine();

            //_httpsv.Stop();
        }
コード例 #2
0
        public void Init()
        {
            _httpsv = new HttpServer(4649);
            //_httpsv.Sweeped = false;
            //_httpsv.AddWebSocketService<Echo>("/Echo");
            _httpsv.AddWebSocketService<KinectService>("/");

            _httpsv.OnGet += (sender, e) =>
            {
                onGet(e);
            };

            _httpsv.OnError += (sender, e) =>
            {
               write(e.Message);
            };

            _httpsv.Start();
            write(String.Format("HTTP Server listening on port: {0} service path:", _httpsv.Port));
            foreach (var path in _httpsv.ServicePaths)
                write(String.Format("  {0}", path));
            write("");

            write("Press any key to stop server...");
            //Console.ReadLine();

            //_httpsv.Stop();
        }
コード例 #3
0
        public void Run(int size, string _url = null)
        {
            rooms = new Dictionary <string, Room>(size);

            if (_url != null)
            {
                url = "http://" + _url + ":80/";
            }

            HttpServer server = new HttpServer(url);

            server.DocumentRootPath = ResourceManager.DocumentRootPath;
            server.OnGet           += HttpResponce;

            Action <User> userCreator = delegate(User user) { user.SetConnectionManager(this); };

            server.AddWebSocketService("/auth", userCreator);

            server.Start();
            if (server.IsListening)
            {
                Console.WriteLine("Listening...");
            }
        }