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


Java SctpServerChannel类代码示例

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


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

示例1: start

import com.sun.nio.sctp.SctpServerChannel; //导入依赖的package包/类
@Override
public void start() throws IOException {

	this.sctpServerChannel = SctpServerChannel.open();		
	sctpServerChannel.bind( new InetSocketAddress(this.getIpAddress(),this.getPort()) );
	sctpServerChannel.configureBlocking( false );
	
	this.selector = Selector.open();
	this.key = sctpServerChannel.register( selector, SelectionKey.OP_ACCEPT );
			
	// Start a daemon thread to handle reception
	this.isRunning = true;
       Thread thread = new Thread(this);
       thread.setDaemon(true);
       thread.setName("SCTPMessageProcessorThread");
       thread.setPriority(Thread.MAX_PRIORITY);
       thread.start();
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:19,代码来源:SCTPMessageProcessor.java

示例2: setOption

import com.sun.nio.sctp.SctpServerChannel; //导入依赖的package包/类
@Override
public <T> SctpServerChannel setOption(SctpSocketOption<T> name, T value)
        throws IOException {
    if (name == null)
        throw new NullPointerException();
    if (!supportedOptions().contains(name))
        throw new UnsupportedOperationException("'" + name + "' not supported");

    synchronized (stateLock) {
        if (!isOpen())
            throw new ClosedChannelException();

        SctpNet.setSocketOption(fdVal, name, value, 0 /*oneToOne*/);
        return this;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:SctpServerChannelImpl.java

示例3: connectChannel

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

示例4: bind

import com.sun.nio.sctp.SctpServerChannel; //导入依赖的package包/类
@Override
public SctpServerChannel bind(SocketAddress local, int backlog)
        throws IOException {
    synchronized (lock) {
        synchronized (stateLock) {
            if (!isOpen())
                throw new ClosedChannelException();
            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,代码行数:29,代码来源:SctpServerChannelImpl.java

示例5: Server

import com.sun.nio.sctp.SctpServerChannel; //导入依赖的package包/类
public Server() throws IOException {
    ssc = SctpServerChannel.open().bind(null);
    java.util.Set<SocketAddress> addrs = ssc.getAllLocalAddresses();
    if (addrs.isEmpty())
        debug("addrs should not be empty");

    serverAddr = (InetSocketAddress) addrs.iterator().next();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:9,代码来源:Send.java

示例6: CommUpServer

import com.sun.nio.sctp.SctpServerChannel; //导入依赖的package包/类
public CommUpServer() throws IOException {
    ssc = SctpServerChannel.open().bind(null);
    java.util.Set<SocketAddress> addrs = ssc.getAllLocalAddresses();
    if (addrs.isEmpty())
        debug("addrs should not be empty");

    serverAddr = (InetSocketAddress) addrs.iterator().next();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:9,代码来源:CommUp.java

示例7: ShutdownServer

import com.sun.nio.sctp.SctpServerChannel; //导入依赖的package包/类
public ShutdownServer() throws IOException {
    ssc = SctpServerChannel.open().bind(null);
    //serverAddr = (InetSocketAddress)(ssc.getAllLocalAddresses().iterator().next());

    java.util.Set<SocketAddress> addrs = ssc.getAllLocalAddresses();
    if (addrs.isEmpty())
        debug("addrs should not be empty");

    serverAddr = (InetSocketAddress) addrs.iterator().next();

}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:12,代码来源:Shutdown.java

示例8: NonblockingServer

import com.sun.nio.sctp.SctpServerChannel; //导入依赖的package包/类
public NonblockingServer() throws IOException {
    ssc = SctpServerChannel.open().bind(null);
    java.util.Set<SocketAddress> addrs = ssc.getAllLocalAddresses();
    if (addrs.isEmpty())
        debug("addrs should not be empty");

    serverAddr = (InetSocketAddress) addrs.iterator().next();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:9,代码来源:NonBlockingAccept.java


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