Examples of OioEventLoopGroup


Examples of io.netty.channel.oio.OioEventLoopGroup

  FileServer(PathResolver pResolver, int port) {
    InetSocketAddress addr = new InetSocketAddress(port);

    // Configure the server.
    bossGroup = new OioEventLoopGroup();
    workerGroup = new OioEventLoopGroup();

    ServerBootstrap bootstrap = new ServerBootstrap();
    bootstrap.group(bossGroup, workerGroup)
        .channel(OioServerSocketChannel.class)
        .option(ChannelOption.SO_BACKLOG, 100)
View Full Code Here

Examples of io.netty.channel.oio.OioEventLoopGroup

    this.handler = handler;
    this.connectTimeout = connectTimeout;
  }

  public void init() {
    group = new OioEventLoopGroup();
    bootstrap = new Bootstrap();
    bootstrap.group(group)
      .channel(OioSocketChannel.class)
      .option(ChannelOption.SO_KEEPALIVE, true)
      .option(ChannelOption.TCP_NODELAY, true)
View Full Code Here

Examples of io.netty.channel.oio.OioEventLoopGroup

public final class RxtxClient {

    public static void main(String[] args) throws Exception {
        Bootstrap b = new Bootstrap();
        try {
            b.group(new OioEventLoopGroup())
             .channel(RxtxChannel.class)
             .handler(new ChannelInitializer<RxtxChannel>() {
                 @Override
                 public void initChannel(RxtxChannel ch) throws Exception {
                     ch.pipeline().addLast(
View Full Code Here

Examples of io.netty.channel.oio.OioEventLoopGroup

    public void run() throws Exception {
        // Configure the server.
        ServerBootstrap b = new ServerBootstrap();
        try {
            b.group(new OioEventLoopGroup(), new OioEventLoopGroup())
             .channel(OioSctpServerChannel.class)
             .option(ChannelOption.SO_BACKLOG, 100)
             .handler(new LoggingHandler(LogLevel.INFO))
             .childHandler(new ChannelInitializer<SctpChannel>() {
                 @Override
View Full Code Here

Examples of io.netty.channel.oio.OioEventLoopGroup

    public void run() throws Exception {
        // Configure the client.
        Bootstrap b = new Bootstrap();
        try {
            b.group(new OioEventLoopGroup())
             .channel(OioSctpChannel.class)
             .option(SctpChannelOption.SCTP_NODELAY, true)
             .handler(new ChannelInitializer<SctpChannel>() {
                 @Override
                 public void initChannel(SctpChannel ch) throws Exception {
View Full Code Here

Examples of io.netty.channel.oio.OioEventLoopGroup

   */
  public Bot(String username, boolean simple, final boolean useSSL) {
    this.username = username;
    this.simple = simple;
    bootstrap = new Bootstrap();
    bootstrap.group(new OioEventLoopGroup());
    bootstrap.channel(OioSocketChannel.class);
    bootstrap.handler(new ChannelInitializer<OioSocketChannel>() {
      @Override
      protected void initChannel(OioSocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
View Full Code Here

Examples of io.netty.channel.oio.OioEventLoopGroup

public class NettyOioServer {

    public void server(int port) throws Exception {
        final ByteBuf buf = Unpooled.unreleasableBuffer(
                Unpooled.copiedBuffer("Hi!\r\n", Charset.forName("UTF-8")));
        EventLoopGroup group = new OioEventLoopGroup();
        try {
            ServerBootstrap b = new ServerBootstrap();

            b.group(group)
             .channel(OioServerSocketChannel.class)
             .localAddress(new InetSocketAddress(port))
             .childHandler(new ChannelInitializer<SocketChannel>() {
                 @Override
                 public void initChannel(SocketChannel ch)
                     throws Exception {
                     ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
                         @Override
                         public void channelActive(ChannelHandlerContext ctx) throws Exception {
                             ctx.write(buf.duplicate()).addListener(ChannelFutureListener.CLOSE);
                         }
                     });
                 }
             });
            ChannelFuture f = b.bind().sync();
            f.channel().closeFuture().sync();
        } finally {
            group.shutdownGracefully().sync();
        }
    }
View Full Code Here

Examples of io.netty.channel.oio.OioEventLoopGroup

* @author <a href="mailto:nmaurer@redhat.com">Norman Maurer</a>
*/
public class BootstrapDatagram {
    public void bootstrap() {
        Bootstrap bootstrap = new Bootstrap();
        bootstrap.group(new OioEventLoopGroup()).channel(OioDatagramChannel.class)
                .handler(new SimpleChannelInboundHandler<DatagramPacket>() {
                    @Override
                    public void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
                        // Do something with the packet
                    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.