Package io.netty.bootstrap

Examples of io.netty.bootstrap.ServerBootstrap.bind()


            b.channel(NioServerSocketChannel.class);
            b.handler(new LoggingHandler(LogLevel.INFO));
            b.childHandler(initializer);

            // Bind and start to accept incoming connections.
            ChannelFuture f = b.bind(port).sync();
            this.state = ServerState.RUNNING;

            // Wait until the server socket is closed.
            // In this example, this does not happen, but you can do that to gracefully
            // shut down your server.
View Full Code Here


        InetSocketAddress addr = new InetSocketAddress(configCopy.getPort());
        if (configCopy.getHostname() != null) {
            addr = new InetSocketAddress(configCopy.getHostname(), configCopy.getPort());
        }

        b.bind(addr).syncUninterruptibly();

        log.info("Session store / pubsub factory used: {}", configCopy.getStoreFactory());
        log.info("SocketIO server started at port: {}", configCopy.getPort());
    }
View Full Code Here

    public ChannelFuture start(InetSocketAddress address) {
        ServerBootstrap bootstrap  = new ServerBootstrap();
        bootstrap.group(group)
                .channel(NioServerSocketChannel.class)
                .childHandler(createInitializer(channelGroup));
        ChannelFuture future = bootstrap.bind(address);
        future.syncUninterruptibly();
        channel = future.channel();
        return future;
    }
View Full Code Here

      if (System.getProperty("io.netty.leakDetectionLevel", null) == null) {
        ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.DISABLED);
      }

      channel = bootstrap.bind(buildSocketAddress()).sync().channel();

      boundAddress = (InetSocketAddress) channel.localAddress();

      if (logger.isInfoEnabled()) {
        logger.info(String.format("Ratpack started for http://%s:%s", getBindHost(), getBindPort()));
View Full Code Here

        InetSocketAddress addr = new InetSocketAddress(configCopy.getPort());
        if (configCopy.getHostname() != null) {
            addr = new InetSocketAddress(configCopy.getHostname(), configCopy.getPort());
        }

        b.bind(addr).syncUninterruptibly();

        log.info("Session store / pubsub factory used: {}", configCopy.getStoreFactory());
        log.info("SocketIO server started at port: {}", configCopy.getPort());
    }
View Full Code Here

    }

    bootstrap.childOption(ChannelOption.SO_KEEPALIVE, true);

    // Bind and start to accept incoming connections.
    bootstrap.bind(member.host(), member.port()).addListener(new ChannelFutureListener() {
      @Override
      public void operationComplete(ChannelFuture channelFuture) throws Exception {
        channelFuture.channel().closeFuture().addListener(new ChannelFutureListener() {
          @Override
          public void operationComplete(ChannelFuture future) throws Exception {
View Full Code Here

      ServerBootstrap b = new ServerBootstrap();
      b.group(bossGroup, workerGroup)
        .channel(NioServerSocketChannel.class)
        .childHandler(new HttpSnoopServerInitializer(fw));

      Channel ch = b.bind(fw.host, fw.port).sync().channel();
      ch.closeFuture().sync();
    } finally {
      bossGroup.shutdownGracefully();
      workerGroup.shutdownGracefully();
    }
View Full Code Here

        InetSocketAddress addr = new InetSocketAddress(configCopy.getPort());
        if (configCopy.getHostname() != null) {
            addr = new InetSocketAddress(configCopy.getHostname(), configCopy.getPort());
        }

        b.bind(addr).syncUninterruptibly();
        log.info("SocketIO server started at port: {}", configCopy.getPort());
    }

    protected void initGroups() {
        bossGroup = new NioEventLoopGroup(configCopy.getBossThreads());
View Full Code Here

   
    try {
      ServerBootstrap b = new ServerBootstrap();
      b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class).childHandler(this.defaultChannelInitializer);

      ChannelFuture f = b.bind(localAddress).sync(); // Bind and start to accept incoming connections

      // Wait until the server socket is closed.
      // In this example, this does not happen, but you can do that to gracefully
      // shut down your server.
      f.channel().closeFuture().sync();
View Full Code Here

                .channel(NioServerSocketChannel.class)
                .childHandler(new SockJSChannelInitializer(simplePushServerConfig, datastore, sockJsConfig, reaperExcutorGroup));

            final SocketBinding socketBinding = injectedSocketBinding.getValue();
            logger.info("SimplePush Server binding to [" + socketBinding.getAddress() + ":" + socketBinding.getPort() + "]");
            channel = serverBootstrap.bind(socketBinding.getAddress(), socketBinding.getPort()).sync().channel();
        } catch (final Exception e) {
            throw new StartException(e);
        }
    }
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.