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

The following examples show how to use com.sun.nio.sctp.SctpChannel#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: AssociationImpl.java    From sctp with GNU Affero General Public License v3.0 6 votes vote down vote up
private void doInitiateConnectionSctp() throws IOException {
	// Create a non-blocking socket channel
	this.socketChannelSctp = SctpChannel.open();
	this.socketChannelSctp.configureBlocking(false);

	// bind to host address:port
	this.socketChannelSctp.bind(new InetSocketAddress(this.hostAddress, this.hostPort));
	if (this.extraHostAddresses != null) {
		for (String s : extraHostAddresses) {
			this.socketChannelSctp.bindAddress(InetAddress.getByName(s));
		}
	}

	// Kick off connection establishment
	this.socketChannelSctp.connect(new InetSocketAddress(this.peerAddress, this.peerPort), 32, 32);
}
 
Example 2
Source File: Util.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
static boolean isSCTPSupported() {
    try {
        SctpChannel c = SctpChannel.open();
        c.close();
        return true;
    } catch (IOException ioe) {
        ioe.printStackTrace();
    } catch (UnsupportedOperationException e) {
        out.println(e);
    }

    return false;
}
 
Example 3
Source File: Util.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
static boolean isSCTPSupported() {
    try {
        SctpChannel c = SctpChannel.open();
        c.close();
        return true;
    } catch (IOException ioe) {
        ioe.printStackTrace();
    } catch (UnsupportedOperationException e) {
        out.println(e);
    }

    return false;
}
 
Example 4
Source File: Util.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
static boolean isSCTPSupported() {
    try {
        SctpChannel c = SctpChannel.open();
        c.close();
        return true;
    } catch (IOException ioe) {
        ioe.printStackTrace();
    } catch (UnsupportedOperationException e) {
        out.println(e);
    }

    return false;
}
 
Example 5
Source File: Util.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
static boolean isSCTPSupported() {
    try {
        SctpChannel c = SctpChannel.open();
        c.close();
        return true;
    } catch (IOException ioe) {
        ioe.printStackTrace();
    } catch (UnsupportedOperationException e) {
        out.println(e);
    }

    return false;
}
 
Example 6
Source File: Accept.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
void doClient(SocketAddress peerAddress) {
    SctpChannel channel = null;

    try {
        channel = SctpChannel.open(peerAddress, 0, 0);
        acceptLatch.await();

        /* for test 4 */
        closeByIntLatch.await();
        sleep(500);
        server.thread().interrupt();

        /* for test 5 */
        asyncCloseLatch.await();
        sleep(500);
        server.channel().close();

        /* wait for the server thread to finish */
        join(server.thread(), 10000);
    } catch (IOException ioe) {
        unexpected(ioe);
    } catch (InterruptedException ie) {
        unexpected(ie);
    } finally {
        try { if (channel != null) channel.close(); }
        catch (IOException e) { unexpected(e);}
    }
}
 
Example 7
Source File: NettySctpTransferTest.java    From sctp with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * @return true if sctp is supported by this OS and false in not
 */
public static boolean checkSctpEnabled() {
	try {
		SctpChannel socketChannel = SctpChannel.open();
		socketChannel.close();
		return true;
	} catch (Exception e) {
		return false;
	}
}
 
Example 8
Source File: Util.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
static boolean isSCTPSupported() {
    try {
        SctpChannel c = SctpChannel.open();
        c.close();
        return true;
    } catch (IOException ioe) {
        ioe.printStackTrace();
    } catch (UnsupportedOperationException e) {
        out.println(e);
    }

    return false;
}
 
Example 9
Source File: Util.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
static boolean isSCTPSupported() {
    try {
        SctpChannel c = SctpChannel.open();
        c.close();
        return true;
    } catch (IOException ioe) {
        ioe.printStackTrace();
    } catch (UnsupportedOperationException e) {
        out.println(e);
    }

    return false;
}
 
Example 10
Source File: Util.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
static boolean isSCTPSupported() {
    try {
        SctpChannel c = SctpChannel.open();
        c.close();
        return true;
    } catch (IOException ioe) {
        ioe.printStackTrace();
    } catch (UnsupportedOperationException e) {
        out.println(e);
    }

    return false;
}
 
Example 11
Source File: Accept.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
void doClient(SocketAddress peerAddress) {
    SctpChannel channel = null;

    try {
        channel = SctpChannel.open(peerAddress, 0, 0);
        acceptLatch.await();

        /* for test 4 */
        closeByIntLatch.await();
        sleep(500);
        server.thread().interrupt();

        /* for test 5 */
        asyncCloseLatch.await();
        sleep(500);
        server.channel().close();

        /* wait for the server thread to finish */
        join(server.thread(), 10000);
    } catch (IOException ioe) {
        unexpected(ioe);
    } catch (InterruptedException ie) {
        unexpected(ie);
    } finally {
        try { if (channel != null) channel.close(); }
        catch (IOException e) { unexpected(e);}
    }
}
 
Example 12
Source File: Util.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
static boolean isSCTPSupported() {
    try {
        SctpChannel c = SctpChannel.open();
        c.close();
        return true;
    } catch (IOException ioe) {
        ioe.printStackTrace();
    } catch (UnsupportedOperationException e) {
        out.println(e);
    }

    return false;
}
 
Example 13
Source File: Util.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
static boolean isSCTPSupported() {
    try {
        SctpChannel c = SctpChannel.open();
        c.close();
        return true;
    } catch (IOException ioe) {
        ioe.printStackTrace();
    } catch (UnsupportedOperationException e) {
        out.println(e);
    }

    return false;
}
 
Example 14
Source File: Util.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
static boolean isSCTPSupported() {
    try {
        SctpChannel c = SctpChannel.open();
        c.close();
        return true;
    } catch (IOException ioe) {
        ioe.printStackTrace();
    } catch (UnsupportedOperationException e) {
        out.println(e);
    }

    return false;
}
 
Example 15
Source File: Util.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
static boolean isSCTPSupported() {
    try {
        SctpChannel c = SctpChannel.open();
        c.close();
        return true;
    } catch (IOException ioe) {
        ioe.printStackTrace();
    } catch (UnsupportedOperationException e) {
        out.println(e);
    }

    return false;
}
 
Example 16
Source File: NioSctpChannel.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
private static SctpChannel newSctpChannel() {
    try {
        return SctpChannel.open();
    } catch (IOException e) {
        throw new ChannelException("Failed to open a sctp channel.", e);
    }
}
 
Example 17
Source File: Util.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
static boolean isSCTPSupported() {
    try {
        SctpChannel c = SctpChannel.open();
        c.close();
        return true;
    } catch (IOException ioe) {
        ioe.printStackTrace();
    } catch (UnsupportedOperationException e) {
        out.println(e);
    }

    return false;
}
 
Example 18
Source File: SctpTransferTest.java    From sctp with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * @return true if sctp is supported by this OS and false in not
 */
public static boolean checkSctpEnabled() {
	try {
		SctpChannel socketChannel = SctpChannel.open();
		socketChannel.close();
		return true;
	} catch (Exception e) {
		return false;
	}
}
 
Example 19
Source File: Util.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
static boolean isSCTPSupported() {
    try {
        SctpChannel c = SctpChannel.open();
        c.close();
        return true;
    } catch (IOException ioe) {
        ioe.printStackTrace();
    } catch (UnsupportedOperationException e) {
        out.println(e);
    }

    return false;
}
 
Example 20
Source File: Util.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
static boolean isSCTPSupported() {
    try {
        SctpChannel c = SctpChannel.open();
        c.close();
        return true;
    } catch (IOException ioe) {
        ioe.printStackTrace();
    } catch (UnsupportedOperationException e) {
        out.println(e);
    }

    return false;
}