Esempio n. 1
0
        /// <summary>
        /// Initialise.
        /// </summary>
        private void Initialise()
        {
            // Create the server.
            _server = new WebServer(_multiEndpointModels, _maxNumClients);

            // Assign the on connect action handler.
            _server.Timeout                = 60;
            _server.HeaderTimeout          = 30000;
            _server.RequestTimeout         = 30000;
            _server.ResponseTimeout        = 30000;
            _server.ReadBufferSize         = 32768;
            _server.WriteBufferSize        = 32768;
            _server.ResponseBufferCapacity = 10000000;
            _server.RequestBufferCapacity  = 10000000;
            _server.MaximumReadLength      = 1000000;
            _server.Name          = "Generic Net Server";
            _server.ServiceName   = "GenericNetServer";
            _server.OnWebContext += ManagerServer_OnWebContext;

            // Initialise the server.
            _server.Initialisation();
        }
Esempio n. 2
0
        /// <summary>
        /// Dispose(bool disposing) executes in two distinct scenarios.  If disposing
        /// equals true, the method has been called directly or indirectly by a user's
        /// code. Managed and unmanaged resources can be disposed.  If disposing equals
        /// false, the method has been called by the runtime from inside the finalizer
        /// and you should not reference other objects. Only unmanaged resources can
        /// be disposed.
        /// </summary>
        protected virtual void Dispose(bool disposing)
        {
            // Check to see if Dispose has already been called.
            if (!this._disposed)
            {
                // Note disposing has been done.
                _disposed = true;

                // If disposing equals true, dispose all managed
                // and unmanaged resources.
                if (disposing)
                {
                    // Dispose managed resources.
                    if (_server != null)
                    {
                        _server.Dispose();
                    }
                }

                // Call the appropriate methods to clean up
                // unmanaged resources here.
                _server = null;
            }
        }