当前位置: 首页>>代码示例>>Java>>正文


Java SctpMultiChannel类代码示例

本文整理汇总了Java中com.sun.nio.sctp.SctpMultiChannel的典型用法代码示例。如果您正苦于以下问题:Java SctpMultiChannel类的具体用法?Java SctpMultiChannel怎么用?Java SctpMultiChannel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SctpMultiChannel类属于com.sun.nio.sctp包,在下文中一共展示了SctpMultiChannel类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setOption

import com.sun.nio.sctp.SctpMultiChannel; //导入依赖的package包/类
@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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:SctpMultiChannelImpl.java

示例2: bind

import com.sun.nio.sctp.SctpMultiChannel; //导入依赖的package包/类
@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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:SctpMultiChannelImpl.java

示例3: shutdown

import com.sun.nio.sctp.SctpMultiChannel; //导入依赖的package包/类
@Override
public SctpMultiChannel shutdown(Association association)
        throws IOException {
    synchronized (stateLock) {
        checkAssociation(association);
        if (!isOpen())
            throw new ClosedChannelException();

        SctpNet.shutdown(fdVal, association.associationID());
    }
    return this;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:SctpMultiChannelImpl.java

示例4: Server

import com.sun.nio.sctp.SctpMultiChannel; //导入依赖的package包/类
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();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:9,代码来源:Send.java

示例5: optionalSupport

import com.sun.nio.sctp.SctpMultiChannel; //导入依赖的package包/类
<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);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:SocketOptionTests.java


注:本文中的com.sun.nio.sctp.SctpMultiChannel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。