Examples of SocketChannelConfig


Examples of io.netty.channel.socket.SocketChannelConfig

        return getField(cur, fieldNames[fieldNames.length - 1]);
    }

    public static int getFd(NioSocketChannel channel) throws NoSuchFieldException, IllegalAccessException, IOException {

        SocketChannelConfig config = channel.config();

        BoundField f = getField( config, "javaSocket" );
        Socket socket = (Socket) f.get();

        InputStream in = socket.getInputStream();
View Full Code Here

Examples of io.netty.channel.socket.SocketChannelConfig

        .option(ChannelOption.SO_REUSEADDR, options.reuseAddr())
        .localAddress((null == listenAddress ? new InetSocketAddress(3000) : listenAddress))
        .childHandler(new ChannelInitializer<SocketChannel>() {
          @Override
          public void initChannel(final SocketChannel ch) throws Exception {
            SocketChannelConfig config = ch.config();
            config.setReceiveBufferSize(options.rcvbuf());
            config.setSendBufferSize(options.sndbuf());
            config.setKeepAlive(options.keepAlive());
            config.setReuseAddress(options.reuseAddr());
            config.setSoLinger(options.linger());
            config.setTcpNoDelay(options.tcpNoDelay());

            if (log.isDebugEnabled()) {
              log.debug("CONNECT {}", ch);
            }
View Full Code Here

Examples of org.jboss.netty.channel.socket.SocketChannelConfig

            // Wait until the connection is open in the server side.
            while (pch.child == null) {
                Thread.yield();
            }

            SocketChannelConfig cfg = (SocketChannelConfig) pch.child.getConfig();
            if (BUFSIZE_MODIFIABLE) {
                assertEquals(9753, cfg.getReceiveBufferSize());
                assertEquals(8642, cfg.getSendBufferSize());
            }
        } finally {
            if (socket != null) {
                try {
                    socket.close();
View Full Code Here

Examples of org.jboss.netty.channel.socket.SocketChannelConfig

      ip2client.put(hostport, client)// This is guaranteed to return null.
    }
    client2regions.put(client, new ArrayList<RegionInfo>());
    num_connections_created.increment();
    // Configure and connect the channel without locking ip2client.
    final SocketChannelConfig config = chan.getConfig();
    config.setConnectTimeoutMillis(5000);
    config.setTcpNoDelay(true);
    // Unfortunately there is no way to override the keep-alive timeout in
    // Java since the JRE doesn't expose any way to call setsockopt() with
    // TCP_KEEPIDLE.  And of course the default timeout is >2h.  Sigh.
    config.setKeepAlive(true);
    chan.connect(new InetSocketAddress(host, port))// Won't block.
    return client;
  }
View Full Code Here

Examples of org.jboss.netty.channel.socket.SocketChannelConfig

            // Wait until the connection is open in the server side.
            while (pch.child == null) {
                Thread.yield();
            }

            SocketChannelConfig cfg = (SocketChannelConfig) pch.child.getConfig();
            if (BUFSIZE_MODIFIABLE) {
                assertEquals(9753, cfg.getReceiveBufferSize());
                assertEquals(8642, cfg.getSendBufferSize());
            }
        } finally {
            if (socket != null) {
                try {
                    socket.close();
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.