Java Code Examples for com.sun.nio.sctp.SctpServerChannel#open()

The following examples show how to use com.sun.nio.sctp.SctpServerChannel#open() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Bind.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
SctpChannel connectChannel(SctpChannel channel)
    throws IOException {
    debug("connecting channel...");
    try {
        SctpServerChannel ssc = SctpServerChannel.open();
        ssc.bind(null);
        Set<SocketAddress> addrs = ssc.getAllLocalAddresses();
        Iterator<SocketAddress> iterator = addrs.iterator();
        SocketAddress addr = iterator.next();
        debug("using " + addr + "...");
        channel.connect(addr);
        SctpChannel peerChannel = ssc.accept();
        ssc.close();
        debug("connected");
        return peerChannel;
    } catch (IOException ioe) {
        debug("Cannot connect channel");
        unexpected(ioe);
        throw ioe;
    }
}
 
Example 2
Source File: Bind.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
SctpChannel connectChannel(SctpChannel channel)
    throws IOException {
    debug("connecting channel...");
    try {
        SctpServerChannel ssc = SctpServerChannel.open();
        ssc.bind(null);
        Set<SocketAddress> addrs = ssc.getAllLocalAddresses();
        Iterator<SocketAddress> iterator = addrs.iterator();
        SocketAddress addr = iterator.next();
        debug("using " + addr + "...");
        channel.connect(addr);
        SctpChannel peerChannel = ssc.accept();
        ssc.close();
        debug("connected");
        return peerChannel;
    } catch (IOException ioe) {
        debug("Cannot connect channel");
        unexpected(ioe);
        throw ioe;
    }
}
 
Example 3
Source File: ServerImpl.java    From sctp with GNU Affero General Public License v3.0 6 votes vote down vote up
private void doInitSocketSctp() throws IOException {
	// Create a new non-blocking server socket channel
	this.serverChannelSctp = SctpServerChannel.open();
	this.serverChannelSctp.configureBlocking(false);

	// Bind the server socket to the specified address and port
	InetSocketAddress isa = new InetSocketAddress(this.hostAddress, this.hostport);
	this.serverChannelSctp.bind(isa);
	if (this.extraHostAddresses != null) {
		for (String s : extraHostAddresses) {

			this.serverChannelSctp.bindAddress(InetAddress.getByName(s));
		}
	}

	if (logger.isInfoEnabled()) {
		logger.info(String.format("SctpServerChannel bound to=%s ", serverChannelSctp.getAllLocalAddresses()));
	}
}
 
Example 4
Source File: Bind.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
SctpChannel connectChannel(SctpChannel channel)
    throws IOException {
    debug("connecting channel...");
    try {
        SctpServerChannel ssc = SctpServerChannel.open();
        ssc.bind(null);
        Set<SocketAddress> addrs = ssc.getAllLocalAddresses();
        Iterator<SocketAddress> iterator = addrs.iterator();
        SocketAddress addr = iterator.next();
        debug("using " + addr + "...");
        channel.connect(addr);
        SctpChannel peerChannel = ssc.accept();
        ssc.close();
        debug("connected");
        return peerChannel;
    } catch (IOException ioe) {
        debug("Cannot connect channel");
        unexpected(ioe);
        throw ioe;
    }
}
 
Example 5
Source File: Bind.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
SctpChannel connectChannel(SctpChannel channel)
    throws IOException {
    debug("connecting channel...");
    try {
        SctpServerChannel ssc = SctpServerChannel.open();
        ssc.bind(null);
        Set<SocketAddress> addrs = ssc.getAllLocalAddresses();
        Iterator<SocketAddress> iterator = addrs.iterator();
        SocketAddress addr = iterator.next();
        debug("using " + addr + "...");
        channel.connect(addr);
        SctpChannel peerChannel = ssc.accept();
        ssc.close();
        debug("connected");
        return peerChannel;
    } catch (IOException ioe) {
        debug("Cannot connect channel");
        unexpected(ioe);
        throw ioe;
    }
}
 
Example 6
Source File: Bind.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
SctpChannel connectChannel(SctpChannel channel)
    throws IOException {
    debug("connecting channel...");
    try {
        SctpServerChannel ssc = SctpServerChannel.open();
        ssc.bind(null);
        Set<SocketAddress> addrs = ssc.getAllLocalAddresses();
        Iterator<SocketAddress> iterator = addrs.iterator();
        SocketAddress addr = iterator.next();
        debug("using " + addr + "...");
        channel.connect(addr);
        SctpChannel peerChannel = ssc.accept();
        ssc.close();
        debug("connected");
        return peerChannel;
    } catch (IOException ioe) {
        debug("Cannot connect channel");
        unexpected(ioe);
        throw ioe;
    }
}
 
Example 7
Source File: Bind.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
SctpChannel connectChannel(SctpChannel channel)
    throws IOException {
    debug("connecting channel...");
    try {
        SctpServerChannel ssc = SctpServerChannel.open();
        ssc.bind(null);
        Set<SocketAddress> addrs = ssc.getAllLocalAddresses();
        Iterator<SocketAddress> iterator = addrs.iterator();
        SocketAddress addr = iterator.next();
        debug("using " + addr + "...");
        channel.connect(addr);
        SctpChannel peerChannel = ssc.accept();
        ssc.close();
        debug("connected");
        return peerChannel;
    } catch (IOException ioe) {
        debug("Cannot connect channel");
        unexpected(ioe);
        throw ioe;
    }
}
 
Example 8
Source File: Bind.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
SctpChannel connectChannel(SctpChannel channel)
    throws IOException {
    debug("connecting channel...");
    try {
        SctpServerChannel ssc = SctpServerChannel.open();
        ssc.bind(null);
        Set<SocketAddress> addrs = ssc.getAllLocalAddresses();
        Iterator<SocketAddress> iterator = addrs.iterator();
        SocketAddress addr = iterator.next();
        debug("using " + addr + "...");
        channel.connect(addr);
        SctpChannel peerChannel = ssc.accept();
        ssc.close();
        debug("connected");
        return peerChannel;
    } catch (IOException ioe) {
        debug("Cannot connect channel");
        unexpected(ioe);
        throw ioe;
    }
}
 
Example 9
Source File: Bind.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
SctpChannel connectChannel(SctpChannel channel)
    throws IOException {
    debug("connecting channel...");
    try {
        SctpServerChannel ssc = SctpServerChannel.open();
        ssc.bind(null);
        Set<SocketAddress> addrs = ssc.getAllLocalAddresses();
        Iterator<SocketAddress> iterator = addrs.iterator();
        SocketAddress addr = iterator.next();
        debug("using " + addr + "...");
        channel.connect(addr);
        SctpChannel peerChannel = ssc.accept();
        ssc.close();
        debug("connected");
        return peerChannel;
    } catch (IOException ioe) {
        debug("Cannot connect channel");
        unexpected(ioe);
        throw ioe;
    }
}
 
Example 10
Source File: Bind.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
SctpChannel connectChannel(SctpChannel channel)
    throws IOException {
    debug("connecting channel...");
    try {
        SctpServerChannel ssc = SctpServerChannel.open();
        ssc.bind(null);
        Set<SocketAddress> addrs = ssc.getAllLocalAddresses();
        Iterator<SocketAddress> iterator = addrs.iterator();
        SocketAddress addr = iterator.next();
        debug("using " + addr + "...");
        channel.connect(addr);
        SctpChannel peerChannel = ssc.accept();
        ssc.close();
        debug("connected");
        return peerChannel;
    } catch (IOException ioe) {
        debug("Cannot connect channel");
        unexpected(ioe);
        throw ioe;
    }
}
 
Example 11
Source File: Bind.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
SctpChannel connectChannel(SctpChannel channel)
    throws IOException {
    debug("connecting channel...");
    try {
        SctpServerChannel ssc = SctpServerChannel.open();
        ssc.bind(null);
        Set<SocketAddress> addrs = ssc.getAllLocalAddresses();
        Iterator<SocketAddress> iterator = addrs.iterator();
        SocketAddress addr = iterator.next();
        debug("using " + addr + "...");
        channel.connect(addr);
        SctpChannel peerChannel = ssc.accept();
        ssc.close();
        debug("connected");
        return peerChannel;
    } catch (IOException ioe) {
        debug("Cannot connect channel");
        unexpected(ioe);
        throw ioe;
    }
}
 
Example 12
Source File: Bind.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
SctpChannel connectChannel(SctpChannel channel)
    throws IOException {
    debug("connecting channel...");
    try {
        SctpServerChannel ssc = SctpServerChannel.open();
        ssc.bind(null);
        Set<SocketAddress> addrs = ssc.getAllLocalAddresses();
        Iterator<SocketAddress> iterator = addrs.iterator();
        SocketAddress addr = iterator.next();
        debug("using " + addr + "...");
        channel.connect(addr);
        SctpChannel peerChannel = ssc.accept();
        ssc.close();
        debug("connected");
        return peerChannel;
    } catch (IOException ioe) {
        debug("Cannot connect channel");
        unexpected(ioe);
        throw ioe;
    }
}
 
Example 13
Source File: Bind.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
SctpChannel connectChannel(SctpChannel channel)
    throws IOException {
    debug("connecting channel...");
    try {
        SctpServerChannel ssc = SctpServerChannel.open();
        ssc.bind(null);
        Set<SocketAddress> addrs = ssc.getAllLocalAddresses();
        Iterator<SocketAddress> iterator = addrs.iterator();
        SocketAddress addr = iterator.next();
        debug("using " + addr + "...");
        channel.connect(addr);
        SctpChannel peerChannel = ssc.accept();
        ssc.close();
        debug("connected");
        return peerChannel;
    } catch (IOException ioe) {
        debug("Cannot connect channel");
        unexpected(ioe);
        throw ioe;
    }
}
 
Example 14
Source File: Bind.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
SctpChannel connectChannel(SctpChannel channel)
    throws IOException {
    debug("connecting channel...");
    try {
        SctpServerChannel ssc = SctpServerChannel.open();
        ssc.bind(null);
        Set<SocketAddress> addrs = ssc.getAllLocalAddresses();
        Iterator<SocketAddress> iterator = addrs.iterator();
        SocketAddress addr = iterator.next();
        debug("using " + addr + "...");
        channel.connect(addr);
        SctpChannel peerChannel = ssc.accept();
        ssc.close();
        debug("connected");
        return peerChannel;
    } catch (IOException ioe) {
        debug("Cannot connect channel");
        unexpected(ioe);
        throw ioe;
    }
}
 
Example 15
Source File: OioSctpServerChannel.java    From netty4.0.27Learn with Apache License 2.0 5 votes vote down vote up
private static SctpServerChannel newServerSocket() {
    try {
        return SctpServerChannel.open();
    } catch (IOException e) {
        throw new ChannelException("failed to create a sctp server channel", e);
    }
}
 
Example 16
Source File: NioSctpServerChannel.java    From netty4.0.27Learn with Apache License 2.0 5 votes vote down vote up
private static SctpServerChannel newSocket() {
    try {
        return SctpServerChannel.open();
    } catch (IOException e) {
        throw new ChannelException(
                "Failed to open a server socket.", e);
    }
}
 
Example 17
Source File: NioSctpServerChannel.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
private static SctpServerChannel newSocket() {
    try {
        return SctpServerChannel.open();
    } catch (IOException e) {
        throw new ChannelException(
                "Failed to open a server socket.", e);
    }
}
 
Example 18
Source File: NettyAddressInUseTest.java    From sctp with GNU Affero General Public License v3.0 5 votes vote down vote up
private void doInitSocketServerSctp() throws IOException {
    // Create a new non-blocking server socket channel
    dirtyServerSctp = SctpServerChannel.open();
    dirtyServerSctp.configureBlocking(false);

    // Bind the server socket to the specified address and port
    InetSocketAddress isa = new InetSocketAddress(CLIENT_HOST, CLIENT_PORT);
    dirtyServerSctp.bind(isa);
}
 
Example 19
Source File: AddressInUseTest.java    From sctp with GNU Affero General Public License v3.0 5 votes vote down vote up
private void doInitSocketServerSctp() throws IOException {
	// Create a new non-blocking server socket channel
	dirtyServerSctp = SctpServerChannel.open();
	dirtyServerSctp.configureBlocking(false);

	// Bind the server socket to the specified address and port
	InetSocketAddress isa = new InetSocketAddress(CLIENT_HOST, CLIENT_PORT);
	dirtyServerSctp.bind(isa);
}
 
Example 20
Source File: OioSctpServerChannel.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
private static SctpServerChannel newServerSocket() {
    try {
        return SctpServerChannel.open();
    } catch (IOException e) {
        throw new ChannelException("failed to create a sctp server channel", e);
    }
}