本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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();
}
示例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);
}
}