Run the DAAP server. Start by advertising the server via Bonjour. Then
        serve requests until CTRL + C is received.
546919
def serve_forever(self):
        

        # Verify that the provider has a server.
        if self.provider.server is None:
            raise ValueError(
                "Cannot start server because the provider has no server to "
                "publish.")

        # Verify that the provider has a database to advertise.
        if not self.provider.server.databases:
            raise ValueError(
                "Cannot start server because the provider has no databases to "
                "publish.")

        # Create WSGI server and run it.
        self.server = WSGIServer((self.ip, self.port), application=self.app)

        # Register Bonjour.
        if self.bonjour:
            self.bonjour.publish(self)

        # Start server until finished
        try:
            self.server.serve_forever()
        except KeyboardInterrupt:
            pass
        finally:
            # Unregister Bonjour
            if self.bonjour:
                self.bonjour.unpublish(self)
735460
def start_wsgi_server(port, addr='', registry=REGISTRY):
    """"""
    app = make_wsgi_app(registry)
    httpd = make_server(addr, port, app, handler_class=_SilentHandler)
    t = threading.Thread(target=httpd.serve_forever)
    t.daemon = True
    t.start()
1352081
def start(self):
        
        self.started = True
        if self.app:
            web_port = self.config['network']['web_port']
            logger.info('Starting server listening on port {0}'.format(web_port))
            key_file = os.path.join(self.work_dir, 'server.key')
            cert_file = os.path.join(self.work_dir, 'server.crt')
            http_server = WSGIServer(('', web_port), self.app, keyfile=key_file, certfile=cert_file)
            http_server_greenlet = gevent.spawn(http_server.serve_forever)
            self.greenlets.append(http_server_greenlet)

        stop_if_not_write_workdir(self.work_dir)
        logger.info('Server started.')
        gevent.joinall(self.greenlets)
304351
def run_server(conn, command, sock_path, debug, timeout):
    """"""
    ret = 0
    try:
        handler = protocol.Handler(conn=conn, debug=debug)
        with serve(handler=handler, sock_path=sock_path,
                   timeout=timeout) as env:
            if command:
                ret = server.run_process(command=command, environ=env)
            else:
                signal.pause()  # wait for signal (e.g. SIGINT)
    except KeyboardInterrupt:
        log.info('server stopped')
    return ret
759245
def launch_server():
    
    print(os.path.dirname(os.path.abspath(__file__)))
    cur_dir = os.getcwd()
    path = os.path.dirname(os.path.abspath(__file__))
    run = True
    os.chdir(path)
    os.system('python manage.py runserver --nostatic')
    os.chdir(cur_dir)
339018
def start(self):
        ''''''
        assert self._client is None

        logger.debug('IsolationContext[%d] starting', id(self))

        # Create the queues
        request_queue = multiprocessing.Queue()
        response_queue = multiprocessing.Queue()

        # Launch the server process
        server = Server(request_queue, response_queue)  # Do not keep a reference to this object!
        server_process = multiprocessing.Process(target=server.loop)
        server_process.start()

        # Create a client to talk to the server
        self._client = Client(server_process, request_queue, response_queue)
175033
def run(self):
        
        server_address = (self.host, self.port)
        threading = True
        if threading:
            httpd_cls = type('WSGIServer', (ThreadingMixIn, WSGIServer), {})
        else:
            httpd_cls = WSGIServer
        self.httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=False)
        wsgi_handler = get_internal_wsgi_application()
        self.httpd.set_app(wsgi_handler)
        self.is_ready.set()
        self.httpd.serve_forever()
1212444
def launch_server(message_handler, options):
    
    logger = logging.getLogger(__name__)
    if (options.debug):
        logger.setLevel(logging.DEBUG)

    if not options.monitor_port:
        logger.warning(
            "Monitoring not enabled. No monitor-port option defined.")
    else:
        threading.Thread(target=launch_monitor_server, args=(options.host, options.monitor_port, logger)).start()

    # Create the server, binding to specified host on configured port

    logger.info(
        'Starting server on host %s port %d Python version %s.%s.%s' % ((options.host, options.port) + sys.version_info[:3]))
    server = ThreadedTCPServer((options.host, options.port),
                       StreamHandler.create_handler(message_handler,
                                                    options.buffer_size,
                                                    logger))

    # Activate the server; this will keep running until you
    # interrupt the program with Ctrl-C
    try:
        server.serve_forever()
    except KeyboardInterrupt:
        logger.info("Ctrl-C, exiting...")
        os._exit(142)
293979
public void startup() {
        if (isRunning) return;

        Executors.getInstance().execute(new Runnable() {
            @Override
            public void run() {
                DispatcherHandler handler = new DispatcherHandler(AndServer.getContext());
                ComponentRegister register = new ComponentRegister(AndServer.getContext());
                register.register(handler, mGroup);

                mHttpServer = ServerBootstrap.bootstrap()
                    .setSocketConfig(SocketConfig.custom()
                        .setSoKeepAlive(true)
                        .setSoReuseAddress(true)
                        .setSoTimeout(mTimeout)
                        .setTcpNoDelay(true)
                        .build())
                    .setConnectionConfig(
                        ConnectionConfig.custom().setBufferSize(4 * 1024).setCharset(Charsets.UTF_8).build())
                    .setLocalAddress(mInetAddress)
                    .setListenerPort(mPort)
                    .setSslContext(mSSLContext)
                    .setSslSetupHandler(new SSLInitializerWrapper(mSSLInitializer))
                    .setServerInfo("AndServer/2.0.0")
                    .registerHandler("*", handler)
                    .setExceptionLogger(ExceptionLogger.NO_OP)
                    .create();
                try {
                    isRunning = true;
                    mHttpServer.start();

                    Executors.getInstance().post(new Runnable() {
                        @Override
                        public void run() {
                            if (mListener != null) mListener.onStarted();
                        }
                    });
                    Runtime.getRuntime().addShutdownHook(new Thread() {
                        @Override
                        public void run() {
                            mHttpServer.shutdown(3, TimeUnit.SECONDS);
                        }
                    });
                } catch (final Exception e) {
                    Executors.getInstance().post(new Runnable() {
                        @Override
                        public void run() {
                            if (mListener != null) mListener.onException(e);
                        }
                    });
                }
            }
        });
    }
451073
public void startServer() {

    server = new Server(httpPort);
    server.setHandler(wrapHandlers());

    if (isWebSocketInClassPath()) {
      setupForWebSocket();
    }
    try {
      server.start();
      log().info("server started");

      Runtime.getRuntime().addShutdownHook(new Thread(new ShutdownRunnable()));
      
      if (useStdInShutdown) {
        // generally for use in IDE via JettyRun, Use CTRL-D in IDE console to shutdown
        BufferedReader systemIn = new BufferedReader(new InputStreamReader(System.in, "UTF-8"));
        while((systemIn.readLine()) != null) {
          // ignore anything except CTRL-D by itself
        }
        System.out.println("Shutdown via CTRL-D");
        System.exit(0);
      }

    } catch (Exception e) {
      e.printStackTrace();
      System.exit(100);
    }
  }
182395
def main(port=8000, n_output=10, use_segmenter=False):
    """"""
    global n
    global use_segmenter_flag
    n = n_output
    use_segmenter_flag = use_segmenter
    logging.info("Start webserver...")
    app.run(port=port)
256271
async def start_serving(self, address=None, sockets=None,
                            backlog=100, sslcontext=None):
        
        if self._server:
            raise RuntimeError('Already serving')
        create_server = self._loop.create_server
        server = None
        if sockets:
            for sock in sockets:
                srv = await create_server(self.create_protocol,
                                          sock=sock,
                                          backlog=backlog,
                                          ssl=sslcontext)
                if server:
                    server.sockets.extend(srv.sockets)
                else:
                    server = srv
        elif isinstance(address, tuple):
            server = await create_server(self.create_protocol,
                                         host=address[0],
                                         port=address[1],
                                         backlog=backlog,
                                         ssl=sslcontext)
        else:
            raise RuntimeError('sockets or address must be supplied')
        self._set_server(server)
76650
async def start_serving(self, address=None, sockets=None, **kw):
        
        if self._server:
            raise RuntimeError('Already serving')
        server = DGServer(self._loop)
        loop = self._loop
        if sockets:
            for sock in sockets:
                transport, _ = await loop.create_datagram_endpoint(
                    self.create_protocol, sock=sock)
                server.transports.append(transport)
        elif isinstance(address, tuple):
            transport, _ = await loop.create_datagram_endpoint(
                self.create_protocol, local_addr=address)
            server.transports.append(transport)
        else:
            raise RuntimeError('sockets or address must be supplied')
        self._set_server(server)
52484
def run(addr, port, wsgi_handler, ipv6=False, threading=False, **kwargs):
    
    logger.info('Websocket support is enabled')
    server_address = (addr, port)
    if not threading:
        raise Exception("Django's Websocket server must run with threading enabled")
    httpd_cls = type('WSGIServer', (socketserver.ThreadingMixIn, WSGIServer), {'daemon_threads': True})
    httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
    httpd.set_app(wsgi_handler)
    httpd.serve_forever()
340752
def run_server(dbpath=os.path.expanduser(config.dbserver.file),
               dbhostport=None, loglevel='WARN'):
    
    if dbhostport:  # assume a string of the form "dbhost:port"
        dbhost, port = dbhostport.split(':')
        addr = (dbhost, int(port))
    else:
        addr = (config.dbserver.listen, DBSERVER_PORT)

    # create the db directory if needed
    dirname = os.path.dirname(dbpath)
    if not os.path.exists(dirname):
        os.makedirs(dirname)

    # create and upgrade the db if needed
    db('PRAGMA foreign_keys = ON')  # honor ON DELETE CASCADE
    actions.upgrade_db(db)
    # the line below is needed to work around a very subtle bug of sqlite;
    # we need new connections, see https://github.com/gem/oq-engine/pull/3002
    db.close()

    # reset any computation left in the 'executing' state
    actions.reset_is_running(db)

    # configure logging and start the server
    logging.basicConfig(level=getattr(logging, loglevel))
    DbServer(db, addr).start()
1160048
def start_server(broker, backend=None, port=12223,
                 max_tasks=10000, max_workers=100,
                 blocking=False, debug=False):  # pragma: no cover
    """"""
    _setup_logging(debug)

    queue_listener_dispatcher = Queue()
    listener = EventListener(broker, queue_listener_dispatcher, backend=backend,
                             max_tasks_in_memory=max_tasks,
                             max_workers_in_memory=max_workers)
    dispatcher = StreamingDispatcher(queue_listener_dispatcher)
    clearlysrv = ClearlyServer(listener, dispatcher)
    return _serve(clearlysrv, port, blocking)
634471
def run(app=None, server=WSGIRefServer, host='127.0.0.1', port=8080,
        interval=1, reloader=False, **kargs):
    
    app = app if app else default_app()
    quiet = bool(kargs.get('quiet', False))
    # Instantiate server, if it is a class instead of an instance
    if isinstance(server, type):
        server = server(host=host, port=port, **kargs)
    if not isinstance(server, ServerAdapter):
        raise RuntimeError("Server must be a subclass of WSGIAdapter")
    if not quiet and isinstance(server, ServerAdapter): # pragma: no cover
        if not reloader or os.environ.get('BOTTLE_CHILD') == 'true':
            print("Bottle server starting up (using %s)..." % repr(server))
            print("Listening on http://%s:%d/" % (server.host, server.port))
            print("Use Ctrl-C to quit.")
            print()
        else:
            print("Bottle auto reloader starting up...")
    try:
        if reloader and interval:
            reloader_run(server, app, interval)
        else:
            server.run(app)
    except KeyboardInterrupt:
        if not quiet: # pragma: no cover
            print("Shutting Down...")