com.sun.nio.sctp.SctpMultiChannel Java Examples

The following examples show how to use com.sun.nio.sctp.SctpMultiChannel. 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: SctpMultiChannelImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public <T> SctpMultiChannel setOption(SctpSocketOption<T> name,
                                      T value,
                                      Association association)
        throws IOException {
    if (name == null)
        throw new NullPointerException();
    if (!(supportedOptions().contains(name)))
        throw new UnsupportedOperationException("'" + name + "' not supported");

    synchronized (stateLock) {
        if (association != null && (name.equals(SCTP_PRIMARY_ADDR) ||
                name.equals(SCTP_SET_PEER_PRIMARY_ADDR))) {
            checkAssociation(association);
        }
        if (!isOpen())
            throw new ClosedChannelException();

        int assocId = association == null ? 0 : association.associationID();
        SctpNet.setSocketOption(fdVal, name, value, assocId);
    }
    return this;
}
 
Example #2
Source File: SctpMultiChannelImpl.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public <T> SctpMultiChannel setOption(SctpSocketOption<T> name,
                                      T value,
                                      Association association)
        throws IOException {
    if (name == null)
        throw new NullPointerException();
    if (!(supportedOptions().contains(name)))
        throw new UnsupportedOperationException("'" + name + "' not supported");

    synchronized (stateLock) {
        if (association != null && (name.equals(SCTP_PRIMARY_ADDR) ||
                name.equals(SCTP_SET_PEER_PRIMARY_ADDR))) {
            checkAssociation(association);
        }
        if (!isOpen())
            throw new ClosedChannelException();

        int assocId = association == null ? 0 : association.associationID();
        SctpNet.setSocketOption(fdVal, name, value, assocId);
    }
    return this;
}
 
Example #3
Source File: SctpMultiChannelImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public <T> SctpMultiChannel setOption(SctpSocketOption<T> name,
                                      T value,
                                      Association association)
        throws IOException {
    if (name == null)
        throw new NullPointerException();
    if (!(supportedOptions().contains(name)))
        throw new UnsupportedOperationException("'" + name + "' not supported");

    synchronized (stateLock) {
        if (association != null && (name.equals(SCTP_PRIMARY_ADDR) ||
                name.equals(SCTP_SET_PEER_PRIMARY_ADDR))) {
            checkAssociation(association);
        }
        if (!isOpen())
            throw new ClosedChannelException();

        int assocId = association == null ? 0 : association.associationID();
        SctpNet.setSocketOption(fdVal, name, value, assocId);
    }
    return this;
}
 
Example #4
Source File: SctpMultiChannelImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public <T> SctpMultiChannel setOption(SctpSocketOption<T> name,
                                      T value,
                                      Association association)
        throws IOException {
    if (name == null)
        throw new NullPointerException();
    if (!(supportedOptions().contains(name)))
        throw new UnsupportedOperationException("'" + name + "' not supported");

    synchronized (stateLock) {
        if (association != null && (name.equals(SCTP_PRIMARY_ADDR) ||
                name.equals(SCTP_SET_PEER_PRIMARY_ADDR))) {
            checkAssociation(association);
        }
        if (!isOpen())
            throw new ClosedChannelException();

        int assocId = association == null ? 0 : association.associationID();
        SctpNet.setSocketOption(fdVal, name, value, assocId);
    }
    return this;
}
 
Example #5
Source File: SctpMultiChannelImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
public <T> SctpMultiChannel setOption(SctpSocketOption<T> name,
                                      T value,
                                      Association association)
        throws IOException {
    if (name == null)
        throw new NullPointerException();
    if (!(supportedOptions().contains(name)))
        throw new UnsupportedOperationException("'" + name + "' not supported");

    synchronized (stateLock) {
        if (association != null && (name.equals(SCTP_PRIMARY_ADDR) ||
                name.equals(SCTP_SET_PEER_PRIMARY_ADDR))) {
            checkAssociation(association);
        }
        if (!isOpen())
            throw new ClosedChannelException();

        int assocId = association == null ? 0 : association.associationID();
        SctpNet.setSocketOption(fdVal, name, value, assocId);
    }
    return this;
}
 
Example #6
Source File: SctpMultiChannelImpl.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public <T> SctpMultiChannel setOption(SctpSocketOption<T> name,
                                      T value,
                                      Association association)
        throws IOException {
    if (name == null)
        throw new NullPointerException();
    if (!(supportedOptions().contains(name)))
        throw new UnsupportedOperationException("'" + name + "' not supported");

    synchronized (stateLock) {
        if (association != null && (name.equals(SCTP_PRIMARY_ADDR) ||
                name.equals(SCTP_SET_PEER_PRIMARY_ADDR))) {
            checkAssociation(association);
        }
        if (!isOpen())
            throw new ClosedChannelException();

        int assocId = association == null ? 0 : association.associationID();
        SctpNet.setSocketOption(fdVal, name, value, assocId);
    }
    return this;
}
 
Example #7
Source File: SctpMultiChannelImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public <T> SctpMultiChannel setOption(SctpSocketOption<T> name,
                                      T value,
                                      Association association)
        throws IOException {
    if (name == null)
        throw new NullPointerException();
    if (!(supportedOptions().contains(name)))
        throw new UnsupportedOperationException("'" + name + "' not supported");

    synchronized (stateLock) {
        if (association != null && (name.equals(SCTP_PRIMARY_ADDR) ||
                name.equals(SCTP_SET_PEER_PRIMARY_ADDR))) {
            checkAssociation(association);
        }
        if (!isOpen())
            throw new ClosedChannelException();

        int assocId = association == null ? 0 : association.associationID();
        SctpNet.setSocketOption(fdVal, name, value, assocId);
    }
    return this;
}
 
Example #8
Source File: Branch.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public Server() throws IOException {
    serverChannel = SctpMultiChannel.open().bind(null);
    java.util.Set<SocketAddress> addrs = serverChannel.getAllLocalAddresses();
    if (addrs.isEmpty())
        debug("addrs should not be empty");

    serverAddr = (InetSocketAddress) addrs.iterator().next();
}
 
Example #9
Source File: Branch.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public Server() throws IOException {
    serverChannel = SctpMultiChannel.open().bind(null);
    java.util.Set<SocketAddress> addrs = serverChannel.getAllLocalAddresses();
    if (addrs.isEmpty())
        debug("addrs should not be empty");

    serverAddr = (InetSocketAddress) addrs.iterator().next();
}
 
Example #10
Source File: Send.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public Server() throws IOException {
    serverChannel = SctpMultiChannel.open().bind(null);
    java.util.Set<SocketAddress> addrs = serverChannel.getAllLocalAddresses();
    if (addrs.isEmpty())
        debug("addrs should not be empty");

    serverAddr = (InetSocketAddress) addrs.iterator().next();
}
 
Example #11
Source File: SctpMultiChannelImpl.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public SctpMultiChannel bind(SocketAddress local, int backlog)
        throws IOException {
    synchronized (receiveLock) {
        synchronized (sendLock) {
            synchronized (stateLock) {
                ensureOpen();
                if (isBound())
                    SctpNet.throwAlreadyBoundException();
                InetSocketAddress isa = (local == null) ?
                    new InetSocketAddress(0) : Net.checkAddress(local);

                SecurityManager sm = System.getSecurityManager();
                if (sm != null)
                    sm.checkListen(isa.getPort());
                Net.bind(fd, isa.getAddress(), isa.getPort());

                InetSocketAddress boundIsa = Net.localAddress(fd);
                port = boundIsa.getPort();
                localAddresses.add(isa);
                if (isa.getAddress().isAnyLocalAddress())
                    wildcard = true;

                SctpNet.listen(fdVal, backlog < 1 ? 50 : backlog);
            }
        }
    }
    return this;
}
 
Example #12
Source File: Branch.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public Server() throws IOException {
    serverChannel = SctpMultiChannel.open().bind(null);
    java.util.Set<SocketAddress> addrs = serverChannel.getAllLocalAddresses();
    if (addrs.isEmpty())
        debug("addrs should not be empty");

    serverAddr = (InetSocketAddress) addrs.iterator().next();
}
 
Example #13
Source File: SctpMultiChannelImpl.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public SctpMultiChannel bind(SocketAddress local, int backlog)
        throws IOException {
    synchronized (receiveLock) {
        synchronized (sendLock) {
            synchronized (stateLock) {
                ensureOpen();
                if (isBound())
                    SctpNet.throwAlreadyBoundException();
                InetSocketAddress isa = (local == null) ?
                    new InetSocketAddress(0) : Net.checkAddress(local);

                SecurityManager sm = System.getSecurityManager();
                if (sm != null)
                    sm.checkListen(isa.getPort());
                Net.bind(fd, isa.getAddress(), isa.getPort());

                InetSocketAddress boundIsa = Net.localAddress(fd);
                port = boundIsa.getPort();
                localAddresses.add(isa);
                if (isa.getAddress().isAnyLocalAddress())
                    wildcard = true;

                SctpNet.listen(fdVal, backlog < 1 ? 50 : backlog);
            }
        }
    }
    return this;
}
 
Example #14
Source File: SctpMultiChannelImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public SctpMultiChannel shutdown(Association association)
        throws IOException {
    synchronized (stateLock) {
        checkAssociation(association);
        if (!isOpen())
            throw new ClosedChannelException();

        SctpNet.shutdown(fdVal, association.associationID());
    }
    return this;
}
 
Example #15
Source File: SctpMultiChannelImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public SctpMultiChannel shutdown(Association association)
        throws IOException {
    synchronized (stateLock) {
        checkAssociation(association);
        if (!isOpen())
            throw new ClosedChannelException();

        SctpNet.shutdown(fdVal, association.associationID());
    }
    return this;
}
 
Example #16
Source File: SctpMultiChannelImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public SctpMultiChannel bind(SocketAddress local, int backlog)
        throws IOException {
    synchronized (receiveLock) {
        synchronized (sendLock) {
            synchronized (stateLock) {
                ensureOpen();
                if (isBound())
                    SctpNet.throwAlreadyBoundException();
                InetSocketAddress isa = (local == null) ?
                    new InetSocketAddress(0) : Net.checkAddress(local);

                SecurityManager sm = System.getSecurityManager();
                if (sm != null)
                    sm.checkListen(isa.getPort());
                Net.bind(fd, isa.getAddress(), isa.getPort());

                InetSocketAddress boundIsa = Net.localAddress(fd);
                port = boundIsa.getPort();
                localAddresses.add(isa);
                if (isa.getAddress().isAnyLocalAddress())
                    wildcard = true;

                SctpNet.listen(fdVal, backlog < 1 ? 50 : backlog);
            }
        }
    }
    return this;
}
 
Example #17
Source File: Send.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public Server() throws IOException {
    serverChannel = SctpMultiChannel.open().bind(null);
    java.util.Set<SocketAddress> addrs = serverChannel.getAllLocalAddresses();
    if (addrs.isEmpty())
        debug("addrs should not be empty");

    serverAddr = (InetSocketAddress) addrs.iterator().next();
}
 
Example #18
Source File: SctpMultiChannelImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public SctpMultiChannel bind(SocketAddress local, int backlog)
        throws IOException {
    synchronized (receiveLock) {
        synchronized (sendLock) {
            synchronized (stateLock) {
                ensureOpen();
                if (isBound())
                    SctpNet.throwAlreadyBoundException();
                InetSocketAddress isa = (local == null) ?
                    new InetSocketAddress(0) : Net.checkAddress(local);

                SecurityManager sm = System.getSecurityManager();
                if (sm != null)
                    sm.checkListen(isa.getPort());
                Net.bind(fd, isa.getAddress(), isa.getPort());

                InetSocketAddress boundIsa = Net.localAddress(fd);
                port = boundIsa.getPort();
                localAddresses.add(isa);
                if (isa.getAddress().isAnyLocalAddress())
                    wildcard = true;

                SctpNet.listen(fdVal, backlog < 1 ? 50 : backlog);
            }
        }
    }
    return this;
}
 
Example #19
Source File: SocketOptionTests.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
<T> void optionalSupport(SctpMultiChannel smc, SctpSocketOption<T> name,
        T value) {
    try {
        smc.setOption(name, value, null);
        checkOption(smc, name, value);
    } catch (IOException e) {
        /* Informational only, not all options have native support */
        out.println(name + " not supported. " + e);
    }
}
 
Example #20
Source File: SocketOptionTests.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
<T> void optionalSupport(SctpMultiChannel smc, SctpSocketOption<T> name,
        T value) {
    try {
        smc.setOption(name, value, null);
        checkOption(smc, name, value);
    } catch (IOException e) {
        /* Informational only, not all options have native support */
        out.println(name + " not supported. " + e);
    }
}
 
Example #21
Source File: SocketOptionTests.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
<T> void optionalSupport(SctpMultiChannel smc, SctpSocketOption<T> name,
        T value) {
    try {
        smc.setOption(name, value, null);
        checkOption(smc, name, value);
    } catch (IOException e) {
        /* Informational only, not all options have native support */
        out.println(name + " not supported. " + e);
    }
}
 
Example #22
Source File: SctpMultiChannelImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public SctpMultiChannel bind(SocketAddress local, int backlog)
        throws IOException {
    synchronized (receiveLock) {
        synchronized (sendLock) {
            synchronized (stateLock) {
                ensureOpen();
                if (isBound())
                    SctpNet.throwAlreadyBoundException();
                InetSocketAddress isa = (local == null) ?
                    new InetSocketAddress(0) : Net.checkAddress(local);

                SecurityManager sm = System.getSecurityManager();
                if (sm != null)
                    sm.checkListen(isa.getPort());
                Net.bind(fd, isa.getAddress(), isa.getPort());

                InetSocketAddress boundIsa = Net.localAddress(fd);
                port = boundIsa.getPort();
                localAddresses.add(isa);
                if (isa.getAddress().isAnyLocalAddress())
                    wildcard = true;

                SctpNet.listen(fdVal, backlog < 1 ? 50 : backlog);
            }
        }
    }
    return this;
}
 
Example #23
Source File: Send.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public Server() throws IOException {
    serverChannel = SctpMultiChannel.open().bind(null);
    java.util.Set<SocketAddress> addrs = serverChannel.getAllLocalAddresses();
    if (addrs.isEmpty())
        debug("addrs should not be empty");

    serverAddr = (InetSocketAddress) addrs.iterator().next();
}
 
Example #24
Source File: SctpMultiChannelImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public SctpMultiChannel bind(SocketAddress local,
        int backlog) throws IOException {
    throw new UnsupportedOperationException(message);
}
 
Example #25
Source File: SctpMultiChannelImpl.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public SctpMultiChannel unbindAddress(InetAddress address)
     throws IOException {
    throw new UnsupportedOperationException(message);
}
 
Example #26
Source File: SctpMultiChannelImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public SctpMultiChannel unbindAddress(InetAddress address)
     throws IOException {
    throw new UnsupportedOperationException(message);
}
 
Example #27
Source File: SctpMultiChannelImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public <T> SctpMultiChannel setOption(SctpSocketOption<T> name,
        T value, Association association) throws IOException {
    throw new UnsupportedOperationException(message);
}
 
Example #28
Source File: SctpMultiChannelImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
public SctpMultiChannel bindAddress(InetAddress address)
     throws IOException {
    throw new UnsupportedOperationException(message);
}
 
Example #29
Source File: SctpMultiChannelImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public SctpMultiChannel bindAddress(InetAddress address)
     throws IOException {
    throw new UnsupportedOperationException(message);
}
 
Example #30
Source File: SctpMultiChannelImpl.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public <T> SctpMultiChannel setOption(SctpSocketOption<T> name,
        T value, Association association) throws IOException {
    throw new UnsupportedOperationException(message);
}