/** * Binds <code>socket</socket> to the wildcard * <code>address</code>. A port is chosen from this port range. If * the port range is [0,0], then a free port is chosen by the OS. * * @throws IOException if the bind operation fails, or if the * socket is already bound. */ public int bind(Socket socket) throws IOException { return bind(socket, (InetAddress) null); }
/** * Binds <code>socket</socket> to the wildcard * <code>address</code>. A port is chosen from this port range. If * the port range is [0,0], then a free port is chosen by the OS. * * @throws IOException if the bind operation fails, or if the * socket is already bound. */ public int bind(ServerSocket socket, int backlog) throws IOException { return bind(socket, (InetAddress) null, backlog); }
/** * Binds <code>socket</socket> to <code>address</code>. A port is * chosen from this port range. If the port range is [0,0], then a * free port is chosen by the OS. * * @throws IOException if the bind operation fails, or if the * socket is already bound. */ public int bind(ServerSocket socket, InetAddress address) throws IOException { return bind(socket, address, 0); }
/** * Binds <code>socket</socket> to the wildcard * <code>address</code>. A port is chosen from this port range. If * the port range is [0,0], then a free port is chosen by the OS. * * @throws IOException if the bind operation fails, or if the * socket is already bound. */ public int bind(ServerSocket socket) throws IOException { return bind(socket, (InetAddress) null); }
/** * Binds <code>socket</socket> to <code>endpoint</code>. If the * port in <code>endpoint</code> is zero, then a port is chosen * from this port range. If the port range is [0,0], then a free * port is chosen by the OS. * * @throws IOException if the bind operation fails, or if the * socket is already bound. */ public int bind(Socket socket, InetSocketAddress endpoint) throws IOException { int port = endpoint.getPort(); PortRange range = (port > 0) ? new PortRange(port) : this; return range.bind(socket, endpoint.getAddress()); }
/** * Binds <code>socket</socket> to <code>endpoint</code>. If the * port in <code>endpoint</code> is zero, then a port is chosen * from this port range. If the port range is [0,0], then a free * port is chosen by the OS. * * @throws IOException if the bind operation fails, or if the * socket is already bound. */ public int bind(ServerSocket socket, InetSocketAddress endpoint) throws IOException { int port = endpoint.getPort(); PortRange range = (port > 0) ? new PortRange(port) : this; return range.bind(socket, endpoint.getAddress(), 0); }
range.bind(channel.socket(), queue); serverSocket = channel.socket();
public HostPortList setStripedPassive(PortRange range, int queue) throws IOException { // remove existing sockets, if any socketPool.flush(); if (serverSocket == null) { ServerSocketChannel channel = ServerSocketChannel.open(); range.bind(channel.socket(), queue); serverSocket = channel.socket(); } gSession.serverMode = GridFTPSession.SERVER_EPAS; gSession.serverAddressList = new HostPortList(); String address = NetworkUtils.getLocalAddress(InetAddress.getByName(remoteControlChannel.getHost())).getHostAddress(); int localPort = serverSocket.getLocalPort(); HostPort hp = null; if (remoteControlChannel.isIPv6()) { String version = HostPort6.getIPAddressVersion(address); hp = new HostPort6(version, address, localPort); } else { hp = new HostPort(address, localPort); } gSession.serverAddressList.add(hp); logger.debug("started single striped passive server at port {}", gSession.serverAddressList.get(0).getPort()); return gSession.serverAddressList; }