當前位置: 首頁>>代碼示例>>Java>>正文


Java OioSctpChannel類代碼示例

本文整理匯總了Java中io.netty.channel.sctp.oio.OioSctpChannel的典型用法代碼示例。如果您正苦於以下問題:Java OioSctpChannel類的具體用法?Java OioSctpChannel怎麽用?Java OioSctpChannel使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


OioSctpChannel類屬於io.netty.channel.sctp.oio包,在下文中一共展示了OioSctpChannel類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: sctpClientChannel

import io.netty.channel.sctp.oio.OioSctpChannel; //導入依賴的package包/類
static List<BootstrapFactory<Bootstrap>> sctpClientChannel() {
    if (!TestUtils.isSctpSupported()) {
        return Collections.emptyList();
    }

    List<BootstrapFactory<Bootstrap>> list = new ArrayList<BootstrapFactory<Bootstrap>>();
    list.add(new BootstrapFactory<Bootstrap>() {
        @Override
        public Bootstrap newInstance() {
            return new Bootstrap().group(nioWorkerGroup).channel(NioSctpChannel.class);
        }
    });
    list.add(new BootstrapFactory<Bootstrap>() {
        @Override
        public Bootstrap newInstance() {
            return new Bootstrap().group(oioWorkerGroup).channel(OioSctpChannel.class);
        }
    });
    return list;
}
 
開發者ID:wuyinxian124,項目名稱:netty4.0.27Learn,代碼行數:21,代碼來源:SctpTestPermutation.java

示例2: sctpClientChannel

import io.netty.channel.sctp.oio.OioSctpChannel; //導入依賴的package包/類
static List<Factory<Bootstrap>> sctpClientChannel() {
    if (!TestUtils.isSctpSupported()) {
        return Collections.emptyList();
    }

    List<Factory<Bootstrap>> list = new ArrayList<Factory<Bootstrap>>();
    list.add(new Factory<Bootstrap>() {
        @Override
        public Bootstrap newInstance() {
            return new Bootstrap().group(nioWorkerGroup).channel(NioSctpChannel.class);
        }
    });
    list.add(new Factory<Bootstrap>() {
        @Override
        public Bootstrap newInstance() {
            return new Bootstrap().group(oioWorkerGroup).channel(OioSctpChannel.class);
        }
    });
    return list;
}
 
開發者ID:kyle-liu,項目名稱:netty4study,代碼行數:21,代碼來源:SctpTestPermutation.java

示例3: run

import io.netty.channel.sctp.oio.OioSctpChannel; //導入依賴的package包/類
public void run() throws Exception {
    // Configure the client.
    EventLoopGroup group = new OioEventLoopGroup();
    try {
        Bootstrap b = new Bootstrap();
        b.group(group)
         .channel(OioSctpChannel.class)
         .option(SctpChannelOption.SCTP_NODELAY, true)
         .handler(new ChannelInitializer<SctpChannel>() {
             @Override
             public void initChannel(SctpChannel ch) throws Exception {
                 ch.pipeline().addLast(
                         new LoggingHandler(LogLevel.INFO),
                         new SctpEchoClientHandler(firstMessageSize));
             }
         });

        // Start the client.
        ChannelFuture f = b.connect(host, port).sync();

        // Wait until the connection is closed.
        f.channel().closeFuture().sync();
    } finally {
        // Shut down the event loop to terminate all threads.
        group.shutdownGracefully();
    }
}
 
開發者ID:kyle-liu,項目名稱:netty4study,代碼行數:28,代碼來源:OioSctpEchoClient.java


注:本文中的io.netty.channel.sctp.oio.OioSctpChannel類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。