类io.netty.channel.sctp.SctpChannel源码实例Demo

下面列出了怎么用io.netty.channel.sctp.SctpChannel的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: netty-cookbook   文件: SimpleSctpServer.java
public static void main(String[] args) throws Exception {       
    EventLoopGroup mainLoop = new NioEventLoopGroup(1);
    EventLoopGroup workerLoop = new NioEventLoopGroup();
    try {
    	ChannelFuture f = new ServerBootstrap().group(mainLoop, workerLoop)
         .channel(NioSctpServerChannel.class)
         .option(ChannelOption.SO_BACKLOG, 100)
         .handler(new LoggingHandler(LogLevel.INFO))
         .childHandler(new ChannelInitializer<SctpChannel>() {
             @Override
             public void initChannel(SctpChannel ch) throws Exception {
            	 ChannelPipeline p = ch.pipeline();                	
                 p.addLast(new SimpleSctpServerHandler());
             }
         }).bind(PORT).sync();            
        f.channel().closeFuture().sync();
    } finally {            
        mainLoop.shutdownGracefully();
        workerLoop.shutdownGracefully();
    }
}
 
源代码2 项目: netty-cookbook   文件: SimpleSctpClient.java
public static void main(String[] args) throws Exception {        
    EventLoopGroup loopGroup = new NioEventLoopGroup();
    try {            
    	ChannelFuture f = new Bootstrap().group(loopGroup)
         .channel(NioSctpChannel.class)
         // set SCTP option
         .option(SctpChannelOption.SCTP_NODELAY, true) 
         .handler(new ChannelInitializer<SctpChannel>() {
             @Override
             public void initChannel(SctpChannel ch) throws Exception {
            	 ChannelPipeline p = ch.pipeline();
                 p.addLast(new SimpleSctpClientHandler());
             }
         }).connect(HOST, PORT).sync();            
        f.channel().closeFuture().sync();
    } finally {
    	loopGroup.shutdownGracefully();
    }
}
 
源代码3 项目: netty-cookbook   文件: SimpleSctpServer.java
public static void main(String[] args) throws Exception {       
    EventLoopGroup mainLoop = new NioEventLoopGroup(1);
    EventLoopGroup workerLoop = new NioEventLoopGroup();
    try {
    	ChannelFuture f = new ServerBootstrap().group(mainLoop, workerLoop)
         .channel(NioSctpServerChannel.class)
         .option(ChannelOption.SO_BACKLOG, 100)
         .handler(new LoggingHandler(LogLevel.INFO))
         .childHandler(new ChannelInitializer<SctpChannel>() {
             @Override
             public void initChannel(SctpChannel ch) throws Exception {
            	 ChannelPipeline p = ch.pipeline();                	
                 p.addLast(new SimpleSctpServerHandler());
             }
         }).bind(PORT).sync();            
        f.channel().closeFuture().sync();
    } finally {            
        mainLoop.shutdownGracefully();
        workerLoop.shutdownGracefully();
    }
}
 
源代码4 项目: netty-cookbook   文件: SimpleSctpClient.java
public static void main(String[] args) throws Exception {        
    EventLoopGroup loopGroup = new NioEventLoopGroup();
    try {            
    	ChannelFuture f = new Bootstrap().group(loopGroup)
         .channel(NioSctpChannel.class)
         // set SCTP option
         .option(SctpChannelOption.SCTP_NODELAY, true) 
         .handler(new ChannelInitializer<SctpChannel>() {
             @Override
             public void initChannel(SctpChannel ch) throws Exception {
            	 ChannelPipeline p = ch.pipeline();
                 p.addLast(new SimpleSctpClientHandler());
             }
         }).connect(HOST, PORT).sync();            
        f.channel().closeFuture().sync();
    } finally {
    	loopGroup.shutdownGracefully();
    }
}
 
源代码5 项目: netty-4.1.22   文件: SctpEchoServer.java
public static void main(String[] args) throws Exception {
    // Configure the server.
    EventLoopGroup bossGroup = new NioEventLoopGroup(1);
    EventLoopGroup workerGroup = new NioEventLoopGroup();
    try {
        ServerBootstrap b = new ServerBootstrap();
        b.group(bossGroup, workerGroup)
         .channel(NioSctpServerChannel.class)
         .option(ChannelOption.SO_BACKLOG, 100)
         .handler(new LoggingHandler(LogLevel.INFO))
         .childHandler(new ChannelInitializer<SctpChannel>() {
             @Override
             public void initChannel(SctpChannel ch) throws Exception {
                 ch.pipeline().addLast(
                         //new LoggingHandler(LogLevel.INFO),
                         new SctpEchoServerHandler());
             }
         });

        // Start the server.
        ChannelFuture f = b.bind(PORT).sync();

        // Wait until the server socket is closed.
        f.channel().closeFuture().sync();
    } finally {
        // Shut down all event loops to terminate all threads.
        bossGroup.shutdownGracefully();
        workerGroup.shutdownGracefully();
    }
}
 
源代码6 项目: netty-4.1.22   文件: SctpEchoClient.java
public static void main(String[] args) throws Exception {
    // Configure the client.
    EventLoopGroup group = new NioEventLoopGroup();
    try {
        Bootstrap b = new Bootstrap();
        b.group(group)
         .channel(NioSctpChannel.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());
             }
         });

        // 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();
    }
}
 
源代码7 项目: netty4.0.27Learn   文件: SctpEchoServer.java
public static void main(String[] args) throws Exception {
    // Configure the server.
    EventLoopGroup bossGroup = new NioEventLoopGroup(1);
    EventLoopGroup workerGroup = new NioEventLoopGroup();
    try {
        ServerBootstrap b = new ServerBootstrap();
        b.group(bossGroup, workerGroup)
         .channel(NioSctpServerChannel.class)
         .option(ChannelOption.SO_BACKLOG, 100)
         .handler(new LoggingHandler(LogLevel.INFO))
         .childHandler(new ChannelInitializer<SctpChannel>() {
             @Override
             public void initChannel(SctpChannel ch) throws Exception {
                 ch.pipeline().addLast(
                         //new LoggingHandler(LogLevel.INFO),
                         new SctpEchoServerHandler());
             }
         });

        // Start the server.
        ChannelFuture f = b.bind(PORT).sync();

        // Wait until the server socket is closed.
        f.channel().closeFuture().sync();
    } finally {
        // Shut down all event loops to terminate all threads.
        bossGroup.shutdownGracefully();
        workerGroup.shutdownGracefully();
    }
}
 
源代码8 项目: netty4.0.27Learn   文件: SctpEchoClient.java
public static void main(String[] args) throws Exception {
    // Configure the client.
    EventLoopGroup group = new NioEventLoopGroup();
    try {
        Bootstrap b = new Bootstrap();
        b.group(group)
         .channel(NioSctpChannel.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());
             }
         });

        // 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();
    }
}
 
源代码9 项目: netty-4.1.22   文件: OioSctpLimitStreamsTest.java
@Override
protected Class<? extends SctpChannel> clientClass() {
    return OioSctpChannel.class;
}
 
源代码10 项目: netty-4.1.22   文件: NioSctpLimitStreamsTest.java
@Override
protected Class<? extends SctpChannel> clientClass() {
    return NioSctpChannel.class;
}
 
源代码11 项目: sctp   文件: NettySctpServerChannelInitializer.java
@Override
protected void initChannel(SctpChannel ch) throws Exception {
    ch.pipeline().addLast(new SctpMessageCompletionHandler(),
            new NettySctpServerHandler(this.nettyServerImpl, this.sctpManagementImpl));
}
 
源代码12 项目: sctp   文件: NettySctpClientChannelInitializer.java
@Override
protected void initChannel(SctpChannel ch) throws Exception {
    ch.pipeline().addLast(new SctpMessageCompletionHandler(), new NettySctpClientHandler(this.nettyAssociationImpl));

}
 
 类所在包
 同包方法