Home / Function/ main() — netty Function Reference

main() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  2aa3565f_4fce_be92_5f2d_cce14f1c23a7["main()"]
  4fe357f6_5370_f5c1_df6c_2776baadde60["SctpMultiHomingEchoServer"]
  2aa3565f_4fce_be92_5f2d_cce14f1c23a7 -->|defined in| 4fe357f6_5370_f5c1_df6c_2776baadde60
  style 2aa3565f_4fce_be92_5f2d_cce14f1c23a7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

example/src/main/java/io/netty/example/sctp/multihoming/SctpMultiHomingEchoServer.java lines 46–82

    public static void main(String[] args) throws Exception {
        // Configure the server.
        EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());
        try {
            ServerBootstrap b = new ServerBootstrap();
            b.group(group)
             .channel(NioSctpServerChannel.class)
             .option(ChannelOption.SO_BACKLOG, 100)
             .handler(new LoggingHandler(LogLevel.INFO))
             .childHandler(new ChannelInitializer<SctpChannel>() {
                 @Override
                 public void initChannel(SctpChannel ch) throws Exception {
                     ch.pipeline().addLast(
//                             new LoggingHandler(LogLevel.INFO),
                             new SctpEchoServerHandler());
                 }
             });

            InetSocketAddress localAddress = SocketUtils.socketAddress(SERVER_PRIMARY_HOST, SERVER_PORT);
            InetAddress localSecondaryAddress = SocketUtils.addressByName(SERVER_SECONDARY_HOST);

            // Bind the server to primary address.
            ChannelFuture bindFuture = b.bind(localAddress).sync();

            //Get the underlying sctp channel
            SctpServerChannel channel = (SctpServerChannel) bindFuture.channel();

            //Bind the secondary address
            ChannelFuture connectFuture = channel.bindAddress(localSecondaryAddress).sync();

            // Wait until the connection is closed.
            connectFuture.channel().closeFuture().sync();
        } finally {
            // Shut down all event loops 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/sctp/multihoming/SctpMultiHomingEchoServer.java.
Where is main() defined?
main() is defined in example/src/main/java/io/netty/example/sctp/multihoming/SctpMultiHomingEchoServer.java at line 46.

Analyze Your Own Codebase

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

Try Supermodel Free