本文整理汇总了Java中com.sun.nio.sctp.SctpServerChannel.open方法的典型用法代码示例。如果您正苦于以下问题:Java SctpServerChannel.open方法的具体用法?Java SctpServerChannel.open怎么用?Java SctpServerChannel.open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.nio.sctp.SctpServerChannel
的用法示例。
在下文中一共展示了SctpServerChannel.open方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例2: 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;
}
}
示例3: newServerSocket
import com.sun.nio.sctp.SctpServerChannel; //导入方法依赖的package包/类
private static SctpServerChannel newServerSocket() {
try {
return SctpServerChannel.open();
} catch (IOException e) {
throw new ChannelException("failed to create a sctp server channel", e);
}
}
示例4: newSocket
import com.sun.nio.sctp.SctpServerChannel; //导入方法依赖的package包/类
private static SctpServerChannel newSocket() {
try {
return SctpServerChannel.open();
} catch (IOException e) {
throw new ChannelException(
"Failed to open a server socket.", e);
}
}