main() — netty Function Reference
Architecture documentation for the main() function in TelnetClient.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 2baed923_bc22_178c_fd94_7a0923366fca["main()"] 53e46bcf_f135_1fe4_57dd_8377a83c1c38["TelnetClient"] 2baed923_bc22_178c_fd94_7a0923366fca -->|defined in| 53e46bcf_f135_1fe4_57dd_8377a83c1c38 style 2baed923_bc22_178c_fd94_7a0923366fca fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
example/src/main/java/io/netty/example/telnet/TelnetClient.java lines 40–81
public static void main(String[] args) throws Exception {
// Configure SSL.
final SslContext sslCtx = ServerUtil.buildSslContext();
EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());
try {
Bootstrap b = new Bootstrap();
b.group(group)
.channel(NioSocketChannel.class)
.handler(new TelnetClientInitializer(sslCtx));
// Start the connection attempt.
Channel ch = b.connect(HOST, PORT).sync().channel();
// Read commands from the stdin.
ChannelFuture lastWriteFuture = null;
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
for (;;) {
String line = in.readLine();
if (line == null) {
break;
}
// Sends the received line to the server.
lastWriteFuture = ch.writeAndFlush(line + "\r\n");
// If user typed the 'bye' command, wait until the server closes
// the connection.
if ("bye".equals(line.toLowerCase())) {
ch.closeFuture().sync();
break;
}
}
// Wait until all messages are flushed before closing the channel.
if (lastWriteFuture != null) {
lastWriteFuture.sync();
}
} finally {
group.shutdownGracefully();
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does main() do?
main() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/telnet/TelnetClient.java.
Where is main() defined?
main() is defined in example/src/main/java/io/netty/example/telnet/TelnetClient.java at line 40.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free