Starts the FTP server asynchronously.

@param address The server address or {@code null} for a local address
@param port The server port or {@code 0} to automatically allocate the port
@throws IOException When an error occurs while starting the server
488552
public void listen(InetAddress address, int port) throws IOException {
        if(auth == null) throw new NullPointerException("The Authenticator is null");
        if(socket != null) throw new IOException("Server already started");

        socket = Utils.createServer(port, 50, address, ssl, !explicitSecurity);

        serverThread = new ServerThread();
        serverThread.setDaemon(true);
        serverThread.start();
    }
846943
public void run()
    {
        this.serverSocket = null;
        try
        {
            Log(Level.INFO, "Attempting to create SocketServer...");
            // If requrestedPortNumber is 0 and we have a range of ports specified, then attempt to allocate a port dynamically from that range.
            if (this.requestedPortNumber == 0 && this.portRangeMax != -1 && this.portRangeMin != -1) {
                this.serverSocket = TCPUtils.getSocketInRange(this.portRangeMin, this.portRangeMax, this.choosePortRandomly);
                if (this.serverSocket == null)
                    throw new Exception("Could not allocate port from range.");
            } else	// Attempt to use the requested port - if it's 0, the system will allocate one dynamically.
                this.serverSocket = new ServerSocket(this.requestedPortNumber);	// Use the specified port number
        }
        catch (Exception e)
        {
            SysLog(Level.SEVERE, "Failed to create SocketServer: " + e);
            this.failedToCreate = true;
            return;
        }

        SysLog(Level.INFO, "Listening for messages on port " + this.serverSocket.getLocalPort());

        while (keepRunning)
        {
            Socket socket = null;
            try
            {
                Log(Level.INFO, "Waiting for incoming message...");
                socket = this.serverSocket.accept();
                if (socket != null)
                    Log(Level.INFO, "Connected to: " + socket.getLocalAddress() + "(local), " + socket.getRemoteSocketAddress() + "(remote)");
                else
                    Log(Level.WARNING, "Accept() returns a null socket!?");
            }
            catch (SocketException e)
            {
                SysLog(Level.INFO, "Socket exception - usually caused by ServerSocket being closed under our feet (normal for stopping polling): " + e);
            }
            catch (IOException e)
            {
                SysLog(Level.SEVERE, "Failed to accept socket request: " + e);
            }

            if (socket != null)
            {
                this.connection_count++;
                Runnable connectionHandler = new TCPConnectionHandler(socket, this, this.logname + ":S#" + this.connection_count);
                new Thread(connectionHandler).start();
            }
        }

        if (this.serverSocket != null)
        {
            try
            {
                Log(Level.INFO, "Closing server socket...");
                this.serverSocket.close();
                Log(Level.INFO, "...closed okay.");
            }
            catch (IOException e)
            {
                Log(Level.SEVERE, "Something went wrong closing server socket: " + e);
            }
        }
    }
111781
public void setHttpProxy(String host, int port) {
        if (config == null) {
            config = new AipClientConfiguration();
        }
        this.config.setProxy(host, port, Proxy.Type.HTTP);
    }
1175127
public void init(Socket s)
  {
    _s = s;
    
    _is = null;
    _os = null;
    _needsFlush = false;
  }
1191302
private void setIP(final int startIndex, final String address) {
        final String[] parts = address.split("\\.");
        this.headers.setByte(startIndex + 0, (byte) Integer.parseInt(parts[0]));
        this.headers.setByte(startIndex + 1, (byte) Integer.parseInt(parts[1]));
        this.headers.setByte(startIndex + 2, (byte) Integer.parseInt(parts[2]));
        this.headers.setByte(startIndex + 3, (byte) Integer.parseInt(parts[3]));
        reCalculateChecksum();
    }
387367
public function init($address = '', $port = 0)
    {
        if (!$address && !$port) {
            $info = $this->serverSocketRequest();

            if (!$info['result']) {
                throw new CreateSocketException(print_r($info, true));
            }
            $address = $info['host'];
            $port = $info['port'];
        }

        if ($this->init) {
            $this->socket->close();
        }

        $this->socket->create(AF_INET, SOCK_STREAM, SOL_TCP);

        // wait to populate socket
        sleep(2);

        $this->sprintfIfDebug("connecting %s port %d\n", trim($address), intval($port));

        $this->socket->connect(trim($address), intval($port));

        $out = trim($this->socket->read(2048, PHP_NORMAL_READ));
        // print welcome message
        $this->output->write($out);

        $this->init = true;
    }
1232532
@Override
  public ServerImpl start() throws IOException {
    synchronized (lock) {
      checkState(!started, "Already started");
      checkState(!shutdown, "Shutting down");
      // Start and wait for any ports to actually be bound.

      ServerListenerImpl listener = new ServerListenerImpl();
      for (InternalServer ts : transportServers) {
        ts.start(listener);
        activeTransportServers++;
      }
      executor = Preconditions.checkNotNull(executorPool.getObject(), "executor");
      started = true;
      return this;
    }
  }
792283
public void start() 
		{
		        try 
		        {
		            this.regularBootstrap.bind(new InetSocketAddress(regularConfiguration.getHost(), regularConfiguration.getPort()));
		            if(logger.isInfoEnabled()) {
		            logger.info(regularConfiguration.getName() + " started at " + regularConfiguration.getHost() + " : " + regularConfiguration.getPort());
		            }
		            if(this.securedConfiguration!=null)
		            {
		            	this.securedBootstrap.bind(new InetSocketAddress(securedConfiguration.getHost(), securedConfiguration.getPort()));	
		            	if(logger.isInfoEnabled()) {
		            	logger.info(securedConfiguration.getName() + " uses port : " + securedConfiguration.getPort() + " for TLS clients.");
		            	}
		            }
		        } 
		        catch (ChannelException e) 
		        {
		        	logger.error("Smpp Channel Exception:", e);
		        }
		}
508991
@Override
    public void startServer(String name, int port, String messageOfTheDay)
    {
        for (final ClientListener listener : listeners)
        {
            network.addListener(listener);
        }
        network.addListener(this);
        network.setMessageOfTheDay(messageOfTheDay);
        network.start(name, port);
    }
845390
@Override
    protected void startUp() {
        long traceId = LoggerHelpers.traceEnterWithContext(log, this.objectId, "startUp");
        try {
            log.info("Starting REST server listening on port: {}", this.restServerConfig.getPort());
            if (restServerConfig.isTlsEnabled()) {
                SSLContextConfigurator contextConfigurator = new SSLContextConfigurator();
                contextConfigurator.setKeyStoreFile(restServerConfig.getKeyFilePath());
                contextConfigurator.setKeyStorePass(JKSHelper.loadPasswordFrom(restServerConfig.getKeyFilePasswordPath()));
                httpServer = GrizzlyHttpServerFactory.createHttpServer(baseUri, resourceConfig, true,
                        new SSLEngineConfigurator(contextConfigurator, false, false, false));
            } else {
                httpServer = GrizzlyHttpServerFactory.createHttpServer(baseUri, resourceConfig, true);
            }
        } finally {
            LoggerHelpers.traceLeave(log, this.objectId, "startUp", traceId);
        }
    }
1121004
public static SafeCloseSmtpServer start(int port) {
		SafeCloseSmtpServer server = new SafeCloseSmtpServer(port);
		Thread t = new Thread(server, "Mock SMTP Server Thread");
		t.start();

		// Block until the server socket is created
		try {
			server.startupBarrier.await();
		} catch (InterruptedException e) {
			log.log(Level.WARNING, "Interrupted", e);
		}

		return server;
	}
520998
public void setInetAddress(final String address) {
        try {
            this.inetAddress = InetAddress.getByName(address);
        } catch (final UnknownHostException e) {
            throw new RuntimeException("Invalid address " + address);
        }
    }
545047
@Override
    public void run(SiteProcedureConnection siteConnection)
    {
        hostLog.debug("STARTING: " + this);
        m_mailbox.send(m_initiatorHSIds, m_txnState.getNotice());
        m_txnState.setDone();
        m_queue.flush(getTxnId());
        execLog.l7dlog( Level.TRACE, LogKeys.org_voltdb_ExecutionSite_SendingCompletedWUToDtxn.name(), null);
        hostLog.debug("COMPLETE: " + this);
    }
419764
public void start() throws Exception
    {
        if (isStarted())
            throw new IllegalStateException("Started");

        // Create a new server socket and set to non blocking mode
        _acceptChannel= ServerSocketChannel.open();
        _acceptChannel.configureBlocking(false);

        // Bind the server socket to the local host and port
        _acceptChannel.socket().bind(_address);

        // Read the address back from the server socket to fix issues
        // with listeners on anonymous ports
        _address= (InetSocketAddress)_acceptChannel.socket().getLocalSocketAddress();

        // create a selector;
        _selector= Selector.open();

        // Register accepts on the server socket with the selector.
        _acceptChannel.register(_selector, SelectionKey.OP_ACCEPT);

        // Start selector thread
        _selectorThread= new SelectorThread();
        _selectorThread.start();

        // Start the thread Pool
        super.start();
        log.info("Started SocketChannelListener on " + getHost()+":"+getPort());
    }
1200642
public static SSLServerSocketChannel open(SocketAddress address, SSLContext sslContext) throws IOException
    {
        ServerSocketChannel serverSocketChannel = ServerSocketChannel.open();
        serverSocketChannel.bind(address);
        SSLServerSocketChannel sslSocketChannel = new SSLServerSocketChannel(serverSocketChannel, sslContext);
        return sslSocketChannel;
    }
535574
public NioClient init(InetSocketAddress address) {
		try {
			this.channel = SocketChannel.open(address);
		} catch (IOException e) {
			throw new IORuntimeException(e);
		}
		return this;
	}
1139653
private function start(int $port, string $address, array $options)
    {
        if (!$this->open) {
            throw new ClosedError('The server has been closed.');
        }

        $cryptoMethod = isset($options['crypto_method'])
            ? (int) $options['crypto_method']
            : (isset($options['pem']) ? self::DEFAULT_CRYPTO_METHOD : 0);
        $timeout = isset($options['timeout']) ? (float) $options['timeout'] : self::DEFAULT_TIMEOUT;
        $allowPersistent = isset($options['allow_persistent']) ? (bool) $options['allow_persistent'] : true;

        try {
            $server = $this->factory->create($address, $port, $options);
        } catch (Throwable $exception) {
            $this->close();
            throw $exception;
        }

        $this->servers[] = $server;

        $coroutine = new Coroutine($this->accept($server, $cryptoMethod, $timeout, $allowPersistent));
        $coroutine->done(null, $this->onError);
    }