Package java.net

Examples of java.net.BindException


        {
            logger.debug("Cannot create server socket between ports " +
                         portMin + " and " + portMax);
        }

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


        logger.config ("HttpServer created "+protocol+" "+ addr);
    }

    public void bind (InetSocketAddress addr, int backlog) throws IOException {
        if (bound) {
            throw new BindException ("HttpServer already bound");
        }
        if (addr == null) {
            throw new NullPointerException ("null address");
        }
        ServerSocket socket = schan.socket();
View Full Code Here

                {
                    _acceptor.bind(new InetSocketAddress(addr, port), this, sconfig);
                }
                catch (IOException e)
                {
                    throw new BindException(String.format("Could not bind to %1s:%2s", addr, port));
                }
            }
        }
        else
        {
            try
            {
                _acceptor.bind(new InetSocketAddress(port), this, sconfig);
            }
            catch (IOException e)
            {
                throw new BindException(String.format("Could not bind to *:%1s", port));
            }
        }
        _acceptingConnections  = true;
    }
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

  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

          } catch (IOException ex) {
            // if this is a bind exception,
            // then try the next port number.
            if (ex instanceof BindException) {
              if (!findPort) {
                BindException be = new BindException("Port in use: "
                    + listener.getHost() + ":" + listener.getPort());
                be.initCause(ex);
                throw be;
              }
            } else {
              LOG.info("HttpServer.start() threw a non Bind IOException");
              throw ex;
View Full Code Here

          log.trace("port is busy... " + port + " [" + e.getMessage() + "]");
        }
      }

      if (!server.isStarted()) {
        throw new BindException("no free port in range of [" + PORT_MIN + ".." + PORT_MAX + "]");
      }
    } catch (final Exception e) {
      log.error("server start failed", e);
      throw new ServerRuntimeException(e);
    }
View Full Code Here

          listener.open();
          LOG.info("Jetty bound to port " + listener.getLocalPort());
          break;
        } catch (BindException ex) {
          if (port == 0 || !findPort) {
            BindException be = new BindException("Port in use: "
                + listener.getHost() + ":" + listener.getPort());
            be.initCause(ex);
            throw be;
          }
        }
        // try the next port number
        listener.setPort(++port);
View Full Code Here

        listener.close();
        listener.open();
        break;
      } catch (BindException ex) {
        if (port == 0 || !findPort) {
          BindException be = new BindException(
              "Port in use: " + listener.getHost() + ":" + listener.getPort());
          be.initCause(ex);
          throw be;
        }
      }
      // try the next port number
      listener.setPort(++port);
View Full Code Here

            }
            break;
        }

        if (localPort < MIN_CLIENT_PORT)
            throw new BindException("All ports in use.");

        _output_.write(Integer.toString(server.getLocalPort()).getBytes());
        _output_.write('\0');
        _output_.flush();
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.