コード例 #1
0
        /// <summary>
        /// The start server.
        /// </summary>
        /// <param name="port">
        /// The port.
        /// </param>
        /// <param name="completecallback">
        /// The completecallback.
        /// </param>
        public void StartServer(int port, Action completecallback)
        {
            if (!CefRuntime.CurrentlyOn(CefThreadId.UI))
            {
                Action <int, Action> startServer =
                    (p, c) => this.StartServer(p, c);

                this.PostTask(CefThreadId.UI, startServer, port, completecallback);

                return;
            }

            if (this.mServer == null)
            {
                if (!(port >= 1025 && port <= 65535))
                {
                    return;
                }

                this.Address           = DefaultServerAddress;
                this.Port              = port;
                this.mCompleteCallback = completecallback;

                CefServer.Create(this.Address, (ushort)this.Port, DefaultServerBacklog, this);
            }
        }
コード例 #2
0
        /// <summary>
        /// The start server.
        /// </summary>
        /// <param name="address">
        /// The address.
        /// </param>
        /// <param name="port">
        /// The port.
        /// </param>
        /// <param name="completecallback">
        /// The completecallback.
        /// </param>
        public void StartServer(string address, int port, Action completecallback)
        {
            if (!CefRuntime.CurrentlyOn(CefThreadId.UI))
            {
                Action <string, int, Action> startServer =
                    (a, p, c) => StartServer(a, p, c);

                PostTask(CefThreadId.UI, startServer, address, port, completecallback);

                return;
            }

            if (mServer == null)
            {
                if (!(port >= 1025 && port <= 65535))
                {
                    return;
                }

                Address           = string.IsNullOrWhiteSpace(address) ? DefaultServerAddress : address;
                Port              = port;
                mCompleteCallback = completecallback;


                CefServer.Create(Address, (ushort)Port, DefaultServerBacklog, this);
            }
        }
コード例 #3
0
 public void Connect()
 {
     if (!IsConnected && !string.IsNullOrEmpty(this.Address) && this.Port > 0 && this.Threads > 0)
     {
         CefServer.Create(this.Address, (ushort)this.Port, this.Threads, this);
         IsConnected = true;
     }
 }
コード例 #4
0
        private InternalHandle create(V8Engine engine, bool isConstructCall, InternalHandle _this, InternalHandle[] args)
        {
            if (args.Length == 3)
            {
                var address = args[0].AsString;
                var port    = args[1].AsInt32;
                var threads = args[2].AsInt32;
                if (!string.IsNullOrEmpty(address) && port > 0 && threads > 0)
                {
                    var serverHandler = new ServerHandler();
                    CefServer.Create(address, (ushort)port, threads, serverHandler);
                }
            }

            return(null);
        }