SctpMultiHomingEchoClient Class — netty Architecture
Architecture documentation for the SctpMultiHomingEchoClient class in SctpMultiHomingEchoClient.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 294451b6_d137_1cd3_e44f_aaf1870a1c03["SctpMultiHomingEchoClient"] 34c78799_c715_5127_6809_a959d50f57a0["SctpMultiHomingEchoClient.java"] 294451b6_d137_1cd3_e44f_aaf1870a1c03 -->|defined in| 34c78799_c715_5127_6809_a959d50f57a0 43590045_9383_788d_0c84_0fabaef95dc3["main()"] 294451b6_d137_1cd3_e44f_aaf1870a1c03 -->|method| 43590045_9383_788d_0c84_0fabaef95dc3
Relationship Graph
Source Code
example/src/main/java/io/netty/example/sctp/multihoming/SctpMultiHomingEchoClient.java lines 36–89
public final class SctpMultiHomingEchoClient {
private static final String CLIENT_PRIMARY_HOST = System.getProperty("host.primary", "127.0.0.1");
private static final String CLIENT_SECONDARY_HOST = System.getProperty("host.secondary", "127.0.0.2");
private static final int CLIENT_PORT = Integer.parseInt(System.getProperty("port.local", "8008"));
private static final String SERVER_REMOTE_HOST = System.getProperty("host.remote", "127.0.0.1");
private static final int SERVER_REMOTE_PORT = Integer.parseInt(System.getProperty("port.remote", "8007"));
public static void main(String[] args) throws Exception {
// Configure the client.
EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());
try {
Bootstrap b = new Bootstrap();
b.group(group)
.channel(NioSctpChannel.class)
.option(SctpChannelOption.SCTP_NODELAY, true)
.handler(new ChannelInitializer<SctpChannel>() {
@Override
public void initChannel(SctpChannel ch) throws Exception {
ch.pipeline().addLast(
// new LoggingHandler(LogLevel.INFO),
new SctpEchoClientHandler());
}
});
InetSocketAddress localAddress = SocketUtils.socketAddress(CLIENT_PRIMARY_HOST, CLIENT_PORT);
InetAddress localSecondaryAddress = SocketUtils.addressByName(CLIENT_SECONDARY_HOST);
InetSocketAddress remoteAddress = SocketUtils.socketAddress(SERVER_REMOTE_HOST, SERVER_REMOTE_PORT);
// Bind the client channel.
ChannelFuture bindFuture = b.bind(localAddress).sync();
// Get the underlying sctp channel
SctpChannel channel = (SctpChannel) bindFuture.channel();
// Bind the secondary address.
// Please note that, bindAddress in the client channel should be done before connecting if you have not
// enable Dynamic Address Configuration. See net.sctp.addip_enable kernel param
channel.bindAddress(localSecondaryAddress).sync();
// Finish connect
ChannelFuture connectFuture = channel.connect(remoteAddress).sync();
// Wait until the connection is closed.
connectFuture.channel().closeFuture().sync();
} finally {
// Shut down the event loop to terminate all threads.
group.shutdownGracefully();
}
}
}
Source
Frequently Asked Questions
What is the SctpMultiHomingEchoClient class?
SctpMultiHomingEchoClient is a class in the netty codebase, defined in example/src/main/java/io/netty/example/sctp/multihoming/SctpMultiHomingEchoClient.java.
Where is SctpMultiHomingEchoClient defined?
SctpMultiHomingEchoClient is defined in example/src/main/java/io/netty/example/sctp/multihoming/SctpMultiHomingEchoClient.java at line 36.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free