Package java.net

Examples of java.net.BindException


  static void bind(ServerSocket socket, InetSocketAddress address,
                   int backlog) throws IOException {
    try {
      socket.bind(address, backlog);
    } catch (BindException e) {
      throw new BindException("Problem binding to " + address);
    } catch (SocketException e) {
      // If they try to bind to a different host's address, give a better
      // error message.
      if ("Unresolved address".equals(e.getMessage())) {
        throw new UnknownHostException("Invalid hostname for server: " +
View Full Code Here


          socket.bind( localAddress );
          return true;
        }
        catch (BindException e)
        {
          BindException x = new BindException( "Cannot assign requested address: " + host + ":" + port );
          x.initCause( e );
          throw x;
        }
      }
      catch (Exception e)
      {
View Full Code Here

          serverSocket = new ServerSocket( port, backlog, h );
          return true;
        }
        catch ( BindException e )
        {
          BindException x = new BindException( "Cannot assign requested address: "+h+":"+port );
          x.initCause( e );
          throw x;
        }
      }
      catch ( Exception e )
      {
View Full Code Here

                sslServerSocket =
                        (SSLServerSocket) sslServerSocketFactory.createServerSocket( port, backlog, h);
        }
        catch ( BindException e )
        {
          throw new BindException( "Address already in use: "+h+":"+port );
        }
        catch (IOException ex)
        {
          IOException exc = new IOException(" Problem in setting up SSL Connection. In order to use SSL " +
             " please specify valid keystore location and password using VM arguments." );
View Full Code Here

    @Override
    public void bind(InetSocketAddress addr, int backlog) throws IOException
    {
        if (_started)
            throw new BindException ("Already started");

        // check if there is already a connector listening
        Connector[] connectors = _server.getConnectors();
        if (connectors != null)
            throw new BindException ("Server already bound");
      
        this._addr = addr;
        if (_executor != null && _server.getThreadPool() == null)
        {
            if (Log.isDebugEnabled()) Log.debug("using given Executor for server thread pool");
View Full Code Here

    public TcpSlaveAgentListener(int port) throws IOException {
        super("TCP slave agent listener port="+port);
        try {
            serverSocket = new ServerSocket(port);
        } catch (BindException e) {
            throw (BindException)new BindException("Failed to listen on port "+port+" because it's already in use.").initCause(e);
        }
        this.configuredPort = port;

        LOGGER.info("JNLP slave agent listener started on TCP port "+getPort());
View Full Code Here

        try {
            server.start();
        } catch(VoldemortException ve) {
            if(ve.getCause() instanceof BindException) {
                ve.printStackTrace();
                throw new BindException(ve.getMessage());
            } else {
                throw ve;
            }
        }
View Full Code Here

  public static void bind(ServerSocket socket, InetSocketAddress address,
                          int backlog) throws IOException {
    try {
      socket.bind(address, backlog);
    } catch (BindException e) {
      BindException bindException = new BindException("Problem binding to " + address
                                                      + " : " + e.getMessage());
      bindException.initCause(e);
      throw bindException;
    } catch (SocketException e) {
      // If they try to bind to a different host's address, give a better
      // error message.
      if ("Unresolved address".equals(e.getMessage())) {
View Full Code Here

        {
            logger.warn("Cannot bind socket between ports " + portMin + " and "
                    + portMax + " to target " + host + ":" + port);
        }

        throw new BindException ("PortRangeSocketFactory: no free port between "
                                 + portMin + " and " + portMax);
    }
View Full Code Here

        {
            logger.warn("Cannot bind socket between ports " + portMin + " and "
                    + portMax + " to target " + host + ":" + port);
        }

        throw new BindException ("PortRangeSocketFactory: no free port between "
            + portMin + " and " + portMax);
    }
View Full Code Here

TOP

Related Classes of java.net.BindException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.