Home / Function/ main() — netty Function Reference

main() — netty Function Reference

Architecture documentation for the main() function in EchoClient.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  aa284012_cea2_1367_c4bc_6adcdcc1ef83["main()"]
  9b63ceab_87e3_0d3e_6024_c3e1c3e4b7b3["EchoClient"]
  aa284012_cea2_1367_c4bc_6adcdcc1ef83 -->|defined in| 9b63ceab_87e3_0d3e_6024_c3e1c3e4b7b3
  style aa284012_cea2_1367_c4bc_6adcdcc1ef83 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

example/src/main/java/io/netty/example/echo/EchoClient.java lines 43–75

    public static void main(String[] args) throws Exception {
        // Configure SSL.git
        final SslContext sslCtx = ServerUtil.buildSslContext();

        // Configure the client.
        EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());
        try {
            Bootstrap b = new Bootstrap();
            b.group(group)
             .channel(NioSocketChannel.class)
             .option(ChannelOption.TCP_NODELAY, true)
             .handler(new ChannelInitializer<SocketChannel>() {
                 @Override
                 public void initChannel(SocketChannel ch) throws Exception {
                     ChannelPipeline p = ch.pipeline();
                     if (sslCtx != null) {
                         p.addLast(sslCtx.newHandler(ch.alloc(), HOST, PORT));
                     }
                     //p.addLast(new LoggingHandler(LogLevel.INFO));
                     p.addLast(new EchoClientHandler());
                 }
             });

            // 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();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does main() do?
main() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/echo/EchoClient.java.
Where is main() defined?
main() is defined in example/src/main/java/io/netty/example/echo/EchoClient.java at line 43.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free