Home / Class/ SctpMultiHomingEchoServer Class — netty Architecture

SctpMultiHomingEchoServer Class — netty Architecture

Architecture documentation for the SctpMultiHomingEchoServer class in SctpMultiHomingEchoServer.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  4fe357f6_5370_f5c1_df6c_2776baadde60["SctpMultiHomingEchoServer"]
  23c9df3a_8351_bbbf_7f05_f319445d247a["SctpMultiHomingEchoServer.java"]
  4fe357f6_5370_f5c1_df6c_2776baadde60 -->|defined in| 23c9df3a_8351_bbbf_7f05_f319445d247a
  2aa3565f_4fce_be92_5f2d_cce14f1c23a7["main()"]
  4fe357f6_5370_f5c1_df6c_2776baadde60 -->|method| 2aa3565f_4fce_be92_5f2d_cce14f1c23a7

Relationship Graph

Source Code

example/src/main/java/io/netty/example/sctp/multihoming/SctpMultiHomingEchoServer.java lines 39–83

public final class SctpMultiHomingEchoServer {

    private static final String SERVER_PRIMARY_HOST = System.getProperty("host.primary", "127.0.0.1");
    private static final String SERVER_SECONDARY_HOST = System.getProperty("host.secondary", "127.0.0.2");

    private static final int SERVER_PORT = Integer.parseInt(System.getProperty("port", "8007"));

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

Frequently Asked Questions

What is the SctpMultiHomingEchoServer class?
SctpMultiHomingEchoServer is a class in the netty codebase, defined in example/src/main/java/io/netty/example/sctp/multihoming/SctpMultiHomingEchoServer.java.
Where is SctpMultiHomingEchoServer defined?
SctpMultiHomingEchoServer is defined in example/src/main/java/io/netty/example/sctp/multihoming/SctpMultiHomingEchoServer.java at line 39.

Analyze Your Own Codebase

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

Try Supermodel Free