当前位置: 首页>>代码示例>>Java>>正文


Java NioUdtProvider.BYTE_PROVIDER属性代码示例

本文整理汇总了Java中io.netty.channel.udt.nio.NioUdtProvider.BYTE_PROVIDER属性的典型用法代码示例。如果您正苦于以下问题:Java NioUdtProvider.BYTE_PROVIDER属性的具体用法?Java NioUdtProvider.BYTE_PROVIDER怎么用?Java NioUdtProvider.BYTE_PROVIDER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在io.netty.channel.udt.nio.NioUdtProvider的用法示例。


在下文中一共展示了NioUdtProvider.BYTE_PROVIDER属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

public void run() throws Exception {
    final ThreadFactory connectFactory = new DefaultThreadFactory("rendezvous");
    final NioEventLoopGroup connectGroup = new NioEventLoopGroup(1,
            connectFactory, NioUdtProvider.BYTE_PROVIDER);
    try {
        final Bootstrap bootstrap = new Bootstrap();
        bootstrap.group(connectGroup)
                .channelFactory(NioUdtProvider.BYTE_RENDEZVOUS)
                .handler(new ChannelInitializer<UdtChannel>() {
                    @Override
                    protected void initChannel(UdtChannel ch) throws Exception {
                        ch.pipeline().addLast(
                                new LoggingHandler(LogLevel.INFO),
                                new ByteEchoPeerHandler(messageSize));
                    }
                });
        final ChannelFuture future = bootstrap.connect(peerAddress, myAddress).sync();
        future.channel().closeFuture().sync();
    } finally {
        connectGroup.shutdownGracefully();
    }
}
 
开发者ID:cowthan,项目名称:JavaAyo,代码行数:22,代码来源:ByteEchoPeerBase.java

示例2: run

public void run() throws Exception {
    final ThreadFactory connectFactory = new UtilThreadFactory("rendezvous");
    final NioEventLoopGroup connectGroup = new NioEventLoopGroup(1,
            connectFactory, NioUdtProvider.BYTE_PROVIDER);
    try {
        final Bootstrap bootstrap = new Bootstrap();
        bootstrap.group(connectGroup)
                .channelFactory(NioUdtProvider.BYTE_RENDEZVOUS)
                .handler(new ChannelInitializer<UdtChannel>() {
                    @Override
                    protected void initChannel(UdtChannel ch) throws Exception {
                        ch.pipeline().addLast(
                                new LoggingHandler(LogLevel.INFO),
                                new ByteEchoPeerHandler(messageSize));
                    }
                });
        final ChannelFuture future = bootstrap.connect(peerAddress, myAddress).sync();
        future.channel().closeFuture().sync();
    } finally {
        connectGroup.shutdownGracefully();
    }
}
 
开发者ID:kyle-liu,项目名称:netty4study,代码行数:22,代码来源:ByteEchoPeerBase.java

示例3: getSelectorProvider

@Override
public SelectorProvider getSelectorProvider() {
    if (CC.mp.net.tcpGateway()) return super.getSelectorProvider();
    if (CC.mp.net.udtGateway()) return NioUdtProvider.BYTE_PROVIDER;
    if (CC.mp.net.sctpGateway()) return super.getSelectorProvider();
    return super.getSelectorProvider();
}
 
开发者ID:mpusher,项目名称:mpush,代码行数:7,代码来源:GatewayClient.java

示例4: main

public static void main(String[] args) throws Exception {
    // Configure the client.
    final ThreadFactory connectFactory = new DefaultThreadFactory("connect");
    final NioEventLoopGroup connectGroup = new NioEventLoopGroup(1,
            connectFactory, NioUdtProvider.BYTE_PROVIDER);
    try {
        final Bootstrap boot = new Bootstrap();
        boot.group(connectGroup)
                .channelFactory(NioUdtProvider.BYTE_CONNECTOR)
                .handler(new ChannelInitializer<UdtChannel>() {
                    @Override
                    public void initChannel(final UdtChannel ch)
                            throws Exception {
                        ch.pipeline().addLast(
                                new LoggingHandler(LogLevel.INFO),
                                new ByteEchoClientHandler());
                    }
                });
        // Start the client.
        final ChannelFuture f = boot.connect(HOST, PORT).sync();
        // Wait until the connection is closed.
        f.channel().closeFuture().sync();
    } finally {
        // Shut down the event loop to terminate all threads.
        connectGroup.shutdownGracefully();
    }
}
 
开发者ID:cowthan,项目名称:JavaAyo,代码行数:27,代码来源:ByteEchoClient.java

示例5: main

public static void main(String[] args) throws Exception {
    final ThreadFactory acceptFactory = new DefaultThreadFactory("accept");
    final ThreadFactory connectFactory = new DefaultThreadFactory("connect");
    final NioEventLoopGroup acceptGroup = new NioEventLoopGroup(1, acceptFactory, NioUdtProvider.BYTE_PROVIDER);
    final NioEventLoopGroup connectGroup = new NioEventLoopGroup(1, connectFactory, NioUdtProvider.BYTE_PROVIDER);

    // Configure the server.
    try {
        final ServerBootstrap boot = new ServerBootstrap();
        boot.group(acceptGroup, connectGroup)
                .channelFactory(NioUdtProvider.BYTE_ACCEPTOR)
                .option(ChannelOption.SO_BACKLOG, 10)
                .handler(new LoggingHandler(LogLevel.INFO))
                .childHandler(new ChannelInitializer<UdtChannel>() {
                    @Override
                    public void initChannel(final UdtChannel ch)
                            throws Exception {
                        ch.pipeline().addLast(
                                new LoggingHandler(LogLevel.INFO),
                                new ByteEchoServerHandler());
                    }
                });
        // Start the server.
        final ChannelFuture future = boot.bind(PORT).sync();
        // Wait until the server socket is closed.
        future.channel().closeFuture().sync();
    } finally {
        // Shut down all event loops to terminate all threads.
        acceptGroup.shutdownGracefully();
        connectGroup.shutdownGracefully();
    }
}
 
开发者ID:cowthan,项目名称:JavaAyo,代码行数:32,代码来源:ByteEchoServer.java

示例6: isUdtAvailable

/**
 * Determines if UDT is available on the classpath.
 *
 * @return true if UDT is available
 */
public static boolean isUdtAvailable() {
    try {
        return NioUdtProvider.BYTE_PROVIDER != null;
    } catch (NoClassDefFoundError e) {
        return false;
    }
}
 
开发者ID:wxyzZ,项目名称:little_mitm,代码行数:12,代码来源:ProxyUtils.java

示例7: initializeTransport

private void initializeTransport(TransportProtocol transportProtocol) {
    SelectorProvider selectorProvider = null;
    switch (transportProtocol) {
    case TCP:
        selectorProvider = SelectorProvider.provider();
        break;
    case UDT:
        selectorProvider = NioUdtProvider.BYTE_PROVIDER;
        break;
    default:
        throw new UnknownTransportProtocolError(transportProtocol);
    }

    NioEventLoopGroup inboundAcceptorGroup = new NioEventLoopGroup(
            INCOMING_ACCEPTOR_THREADS,
            new CategorizedThreadFactory("ClientToProxyAcceptor"),
            selectorProvider);
    NioEventLoopGroup inboundWorkerGroup = new NioEventLoopGroup(
            INCOMING_WORKER_THREADS,
            new CategorizedThreadFactory("ClientToProxyWorker"),
            selectorProvider);
    inboundWorkerGroup.setIoRatio(90);
    NioEventLoopGroup outboundWorkerGroup = new NioEventLoopGroup(
            OUTGOING_WORKER_THREADS,
            new CategorizedThreadFactory("ProxyToServerWorker"),
            selectorProvider);
    outboundWorkerGroup.setIoRatio(90);
    this.clientToProxyBossPools.put(transportProtocol,
            inboundAcceptorGroup);
    this.clientToProxyWorkerPools.put(transportProtocol,
            inboundWorkerGroup);
    this.proxyToServerWorkerPools.put(transportProtocol,
            outboundWorkerGroup);
}
 
开发者ID:Elitward,项目名称:LittleProxy,代码行数:34,代码来源:DefaultHttpProxyServer.java

示例8: run

@Override
public void run() {
    final Bootstrap boot = new Bootstrap();
    final ThreadFactory clientFactory = new DefaultThreadFactory("client");
    final NioEventLoopGroup connectGroup = new NioEventLoopGroup(1,
            clientFactory, NioUdtProvider.BYTE_PROVIDER);
    try {
        boot.group(connectGroup)
                .channelFactory(NioUdtProvider.BYTE_CONNECTOR)
                .handler(new ChannelInitializer<UdtChannel>() {

                    @Override
                    protected void initChannel(final UdtChannel ch)
                            throws Exception {
                        final ChannelPipeline pipeline = ch.pipeline();
                        pipeline.addLast("framer",
                                new DelimiterBasedFrameDecoder(8192,
                                        Delimiters.lineDelimiter()));
                        pipeline.addLast("decoder", new StringDecoder(
                                CharsetUtil.UTF_8));
                        pipeline.addLast("encoder", new StringEncoder(
                                CharsetUtil.UTF_8));
                        pipeline.addLast("handler", new ClientHandler());
                    }
                });
        channel = boot.connect(host, port).sync().channel();
        isRunning = true;
        log.info("Client ready.");
        waitForRunning(false);
        log.info("Client closing...");
        channel.close().sync();
        isShutdown = true;
        log.info("Client is done.");
    } catch (final Throwable e) {
        log.error("Client failed.", e);
    } finally {
        connectGroup.shutdownGracefully().syncUninterruptibly();
    }
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:39,代码来源:UDTClientServerConnectionTest.java

示例9: run

public void run() throws Exception {
    // Configure the client.
    final ThreadFactory connectFactory = new UtilThreadFactory("connect");
    final NioEventLoopGroup connectGroup = new NioEventLoopGroup(1,
            connectFactory, NioUdtProvider.BYTE_PROVIDER);
    try {
        final Bootstrap boot = new Bootstrap();
        boot.group(connectGroup)
                .channelFactory(NioUdtProvider.BYTE_CONNECTOR)
                .handler(new ChannelInitializer<UdtChannel>() {
                    @Override
                    public void initChannel(final UdtChannel ch)
                            throws Exception {
                        ch.pipeline().addLast(
                                new LoggingHandler(LogLevel.INFO),
                                new ByteEchoClientHandler(messageSize));
                    }
                });
        // Start the client.
        final ChannelFuture f = boot.connect(host, port).sync();
        // Wait until the connection is closed.
        f.channel().closeFuture().sync();
    } finally {
        // Shut down the event loop to terminate all threads.
        connectGroup.shutdownGracefully();
    }
}
 
开发者ID:kyle-liu,项目名称:netty4study,代码行数:27,代码来源:ByteEchoClient.java

示例10: run

public void run() throws Exception {
    final ThreadFactory acceptFactory = new UtilThreadFactory("accept");
    final ThreadFactory connectFactory = new UtilThreadFactory("connect");
    final NioEventLoopGroup acceptGroup = new NioEventLoopGroup(1,
            acceptFactory, NioUdtProvider.BYTE_PROVIDER);
    final NioEventLoopGroup connectGroup = new NioEventLoopGroup(1,
            connectFactory, NioUdtProvider.BYTE_PROVIDER);
    // Configure the server.
    try {
        final ServerBootstrap boot = new ServerBootstrap();
        boot.group(acceptGroup, connectGroup)
                .channelFactory(NioUdtProvider.BYTE_ACCEPTOR)
                .option(ChannelOption.SO_BACKLOG, 10)
                .handler(new LoggingHandler(LogLevel.INFO))
                .childHandler(new ChannelInitializer<UdtChannel>() {
                    @Override
                    public void initChannel(final UdtChannel ch)
                            throws Exception {
                        ch.pipeline().addLast(
                                new LoggingHandler(LogLevel.INFO),
                                new ByteEchoServerHandler());
                    }
                });
        // Start the server.
        final ChannelFuture future = boot.bind(port).sync();
        // Wait until the server socket is closed.
        future.channel().closeFuture().sync();
    } finally {
        // Shut down all event loops to terminate all threads.
        acceptGroup.shutdownGracefully();
        connectGroup.shutdownGracefully();
    }
}
 
开发者ID:kyle-liu,项目名称:netty4study,代码行数:33,代码来源:ByteEchoServer.java

示例11: bindUdtPort

/**
 * Start listening as a server at the given address..
 *
 * @param addr the address to listen at
 * @param port the port number to listen at
 * @param bindAllNetworkIfs whether to bind on all network interfaces
 * @return true if listening was started
 * @throws ChannelException in case binding failed
 */
private boolean bindUdtPort(InetAddress addr, int port, boolean bindAllNetworkIfs) {

    if (udtPortsToSockets.containsKey(port)) {
        return true;
    }

    ThreadFactory bossFactory = new UtilThreadFactory("boss");
    ThreadFactory workerFactory = new UtilThreadFactory("worker");
    NioEventLoopGroup bossGroup = new NioEventLoopGroup(1, bossFactory,
            NioUdtProvider.BYTE_PROVIDER);
    NioEventLoopGroup workerGroup = new NioEventLoopGroup(1, workerFactory,
            NioUdtProvider.BYTE_PROVIDER);
    NettyUdtServerHandler handler = new NettyUdtServerHandler(component);
    ServerBootstrap bootstrap = new ServerBootstrap();
    bootstrap.group(bossGroup, workerGroup).channelFactory(NioUdtProvider.BYTE_ACCEPTOR)
            .childHandler(new NettyInitializer<UdtChannel>(handler, msgDecoderClass))
            .option(ChannelOption.SO_REUSEADDR, true);

    try {
        if (bindAllNetworkIfs) {
            bootstrap.bind(new InetSocketAddress(port)).sync();
        } else {
            bootstrap.bind(new InetSocketAddress(addr, port)).sync();
        }

        logger.debug("Successfully bound to ip:port {}:{}", addr, port);
    } catch (InterruptedException e) {
        logger.warn("Problem when trying to bind to {}:{}", addr.getHostAddress(), port);
        trigger(new Fault(e.getCause()), control);
        return false;
    }

    InetSocketAddress iAddr = new InetSocketAddress(addr, port);
    udtPortsToSockets.put(port, iAddr);
    udtSocketsToServerBootstraps.put(iAddr, bootstrap);

    return true;
}
 
开发者ID:jimdowling,项目名称:nat-traverser,代码行数:47,代码来源:NettyNetwork.java

示例12: connectUdt

/**
 * Connect to a UDT server.
 *
 * @param remoteAddress the remote address
 * @param localAddress the local address to bind to
 * @return true if connection succeeded
 * @throws ChannelException if connecting failed
 */
private boolean connectUdt(Address remoteAddress, Address localAddress) {
    InetSocketAddress remote = address2SocketAddress(remoteAddress);
    InetSocketAddress local = address2SocketAddress(localAddress);

    if (udtSocketsToBootstraps.containsKey(remote)) {
        return true;
    }

    ThreadFactory workerFactory = new UtilThreadFactory("clientWorker");
    NioEventLoopGroup workerGroup = new NioEventLoopGroup(1, workerFactory,
            NioUdtProvider.BYTE_PROVIDER);
    NettyStreamHandler handler = new NettyStreamHandler(component, Transport.UDT);
    Bootstrap bootstrap = new Bootstrap();
    bootstrap.group(workerGroup).channelFactory(NioUdtProvider.BYTE_CONNECTOR)
            .handler(new NettyInitializer<UdtChannel>(handler, msgDecoderClass))
            .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, CONNECT_TIMEOUT_MS)
            .option(ChannelOption.SO_REUSEADDR, true);

    try {
        UdtChannel c = (UdtChannel) bootstrap.connect(remote, local).sync().channel();
        addLocalSocket(remote, c);
        logger.debug("Successfully connected to ip:port {}", remote.toString());
    } catch (InterruptedException e) {
        logger.warn("Problem when trying to connect to {}", remote.toString());
        trigger(new Fault(e.getCause()), control);
        return false;
    }

    udtSocketsToBootstraps.put(remote, bootstrap);
    return true;
}
 
开发者ID:jimdowling,项目名称:nat-traverser,代码行数:39,代码来源:NettyNetwork.java

示例13: basicEcho

/**
 * verify basic echo byte rendezvous
 */
@Test(timeout = 10 * 1000)
public void basicEcho() throws Exception {

    final int messageSize = 64 * 1024;
    final int transferLimit = messageSize * 16;

    final Meter rate1 = Metrics.newMeter(
            NioUdtMessageRendezvousChannelTest.class, "send rate", "bytes",
            TimeUnit.SECONDS);

    final Meter rate2 = Metrics.newMeter(
            NioUdtMessageRendezvousChannelTest.class, "send rate", "bytes",
            TimeUnit.SECONDS);

    final InetSocketAddress addr1 = UnitHelp.localSocketAddress();
    final InetSocketAddress addr2 = UnitHelp.localSocketAddress();

    final EchoByteHandler handler1 = new EchoByteHandler(rate1, messageSize);
    final EchoByteHandler handler2 = new EchoByteHandler(rate2, messageSize);

    final NioEventLoopGroup group1 = new NioEventLoopGroup(
            1, Executors.defaultThreadFactory(), NioUdtProvider.BYTE_PROVIDER);
    final NioEventLoopGroup group2 = new NioEventLoopGroup(
            1, Executors.defaultThreadFactory(), NioUdtProvider.BYTE_PROVIDER);

    final Bootstrap boot1 = new Bootstrap();
    boot1.group(group1)
         .channelFactory(NioUdtProvider.BYTE_RENDEZVOUS)
         .localAddress(addr1)
         .remoteAddress(addr2)
         .handler(handler1);

    final Bootstrap boot2 = new Bootstrap();
    boot2.group(group1)
         .channelFactory(NioUdtProvider.BYTE_RENDEZVOUS)
         .localAddress(addr2)
         .remoteAddress(addr1)
         .handler(handler2);

    final ChannelFuture connectFuture1 = boot1.connect();
    final ChannelFuture connectFuture2 = boot2.connect();

    while (handler1.meter().count() < transferLimit
            && handler2.meter().count() < transferLimit) {

        log.info("progress : {} {}", handler1.meter().count(), handler2
                .meter().count());

        Thread.sleep(1000);
    }

    connectFuture1.channel().close().sync();
    connectFuture2.channel().close().sync();

    log.info("handler1 : {}", handler1.meter().count());
    log.info("handler2 : {}", handler2.meter().count());

    assertTrue(handler1.meter().count() >= transferLimit);
    assertTrue(handler2.meter().count() >= transferLimit);

    assertEquals(handler1.meter().count(), handler2.meter().count());

    group1.shutdownGracefully();
    group2.shutdownGracefully();

    group1.terminationFuture().sync();
    group2.terminationFuture().sync();
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:71,代码来源:NioUdtByteRendezvousChannelTest.java

示例14: NettyNetwork

public NettyNetwork(NettyInit init) {
        // probably useless to set here as it won't be re-read in most JVMs after start
        System.setProperty("java.net.preferIPv4Stack", "true");

        self = new NettyAddress(init.self);
        customLogCtx.put(MDC_KEY_PORT, Integer.toString(self.getPort()));
        customLogCtx.put(MDC_KEY_IF, self.getIp().getHostAddress());

        boundPort = self.getPort();

        // CONFIG
        Optional<InetAddress> abiO = config().readValue("netty.bindInterface", InetAddress.class);
        if (abiO.isPresent()) {
            alternativeBindIf = abiO.get();
            customLogCtx.put(MDC_KEY_ALT_IF, self.getIp().getHostAddress());
        }

        initLoggingCtx();

        logger.info("Alternative Bind Interface set to {}", alternativeBindIf);

        udtMonitoring = config().getValueOrDefault("netty.udt.monitor", false);
        if (udtMonitoring) {
            logger.info("UDT monitoring requested.");
        }

        udtBufferSizes = config().getValueOrDefault("netty.udt.buffer", -1);
        udtMSS = config().getValueOrDefault("netty.udt.mss", -1);

//        if (!self.equals(init.self)) {
//            LOG.error("Do NOT bind Netty to a virtual address!");
//            System.exit(1);
//        }
        bindTCP = init.protocols.contains(Transport.TCP);
        bindUDP = init.protocols.contains(Transport.UDP);
        bindUDT = init.protocols.contains(Transport.UDT);
        if (bindUDT) {
            boundUDTPort = init.udtPort;
        }

        // Prepare Bootstraps
        bootstrapTCPClient = new Bootstrap();
        bootstrapTCPClient.group(new NioEventLoopGroup()).channel(NioSocketChannel.class)
                .handler(new NettyInitializer<SocketChannel>(new StreamHandler(this, Transport.TCP)))
                .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, CONNECT_TIMEOUT_MS)
                .option(ChannelOption.SO_REUSEADDR, true);
        bootstrapUDTClient = new Bootstrap();
        NioEventLoopGroup groupUDT = new NioEventLoopGroup(0, (Executor) null,
                NioUdtProvider.BYTE_PROVIDER);
        bootstrapUDTClient.group(groupUDT).channelFactory(NioUdtProvider.BYTE_CONNECTOR)
                .handler(new NettyInitializer<SocketChannel>(new StreamHandler(this, Transport.UDT)))
                .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, CONNECT_TIMEOUT_MS)
                .option(ChannelOption.SO_REUSEADDR, true);
        if (this.udtBufferSizes > 0) {
            bootstrapUDTClient.option(UdtChannelOption.PROTOCOL_SEND_BUFFER_SIZE, this.udtBufferSizes)
                    .option(UdtChannelOption.PROTOCOL_RECEIVE_BUFFER_SIZE, this.udtBufferSizes);
        }
        if (udtMonitoring) {
            logger.info("Activating UDT monitoring (client).");
            bootstrapUDTClient.group().scheduleAtFixedRate(new Runnable() {

                @Override
                public void run() {
                    setCustomMDC();
                    try {
                        channels.monitor();
                    } finally {
                        MDC.clear();
                    }
                }
            }, monitoringInterval, monitoringInterval, TimeUnit.MILLISECONDS
            );
        }

        subscribe(startHandler, control);
        subscribe(stopHandler, control);
        subscribe(msgHandler, net);
        subscribe(notifyHandler, net);
        subscribe(delayedHandler, loopback);
        subscribe(dropHandler, loopback);
    }
 
开发者ID:kompics,项目名称:kompics,代码行数:81,代码来源:NettyNetwork.java

示例15: bindUdtPort

private boolean bindUdtPort(final InetAddress addr) {
    NioEventLoopGroup bossGroup = new NioEventLoopGroup(0, (Executor) null,
            NioUdtProvider.BYTE_PROVIDER);
    NioEventLoopGroup workerGroup = new NioEventLoopGroup(0, (Executor) null,
            NioUdtProvider.BYTE_PROVIDER);
    UDTServerHandler handler = new UDTServerHandler(this);
    bootstrapUDT = new ServerBootstrap();
    bootstrapUDT.group(bossGroup, workerGroup).channelFactory(NioUdtProvider.BYTE_ACCEPTOR)
            .childHandler(new NettyInitializer<UdtChannel>(handler))
            .option(ChannelOption.SO_REUSEADDR, true);
    if (this.udtBufferSizes > 0) {
        bootstrapUDT.option(UdtChannelOption.PROTOCOL_SEND_BUFFER_SIZE, this.udtBufferSizes)
                .option(UdtChannelOption.PROTOCOL_RECEIVE_BUFFER_SIZE, this.udtBufferSizes);
        bootstrapUDT.childOption(UdtChannelOption.PROTOCOL_SEND_BUFFER_SIZE, this.udtBufferSizes)
                .childOption(UdtChannelOption.PROTOCOL_RECEIVE_BUFFER_SIZE, this.udtBufferSizes);
    }
    if (udtMonitoring) {
        logger.info("Activating UDT monitoring (server).");
        bootstrapUDT.childGroup().scheduleAtFixedRate(new Runnable() {

            @Override
            public void run() {
                setCustomMDC();
                try {
                    channels.monitor();
                } finally {
                    MDC.clear();
                }
            }
        }, monitoringInterval, monitoringInterval, TimeUnit.MILLISECONDS);
    }
    try {
        Channel c = bootstrapUDT.bind(addr, boundUDTPort).sync().channel();
        InetSocketAddress localAddress = (InetSocketAddress) c.localAddress(); // Should work
        boundUDTPort = localAddress.getPort(); // in case it was 0 -> random port

        logger.info("Successfully bound UDT to ip:port {}:{} with config: {}", new Object[]{addr, boundUDTPort, c.config().getOptions()});
    } catch (InterruptedException e) {
        logger.error("Problem when trying to bind UDT to {}", addr);
        return false;
    }

    return true;
}
 
开发者ID:kompics,项目名称:kompics,代码行数:44,代码来源:NettyNetwork.java


注:本文中的io.netty.channel.udt.nio.NioUdtProvider.BYTE_PROVIDER属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。