QuoteOfTheMomentClient Class — netty Architecture
Architecture documentation for the QuoteOfTheMomentClient class in QuoteOfTheMomentClient.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 4f9964c6_1d09_1770_4a27_1b2c4a01f32c["QuoteOfTheMomentClient"] 8ed2a94f_e216_cf30_92e1_093ad2f12356["QuoteOfTheMomentClient.java"] 4f9964c6_1d09_1770_4a27_1b2c4a01f32c -->|defined in| 8ed2a94f_e216_cf30_92e1_093ad2f12356 b1d07fc5_2287_f232_de8e_0fb88e669738["main()"] 4f9964c6_1d09_1770_4a27_1b2c4a01f32c -->|method| b1d07fc5_2287_f232_de8e_0fb88e669738
Relationship Graph
Source Code
example/src/main/java/io/netty/example/qotm/QuoteOfTheMomentClient.java lines 36–67
public final class QuoteOfTheMomentClient {
static final int PORT = Integer.parseInt(System.getProperty("port", "7686"));
public static void main(String[] args) throws Exception {
EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());
try {
Bootstrap b = new Bootstrap();
b.group(group)
.channel(NioDatagramChannel.class)
.option(ChannelOption.SO_BROADCAST, true)
.handler(new QuoteOfTheMomentClientHandler());
Channel ch = b.bind(0).sync().channel();
// Broadcast the QOTM request to port 8080.
ch.writeAndFlush(new DatagramPacket(
Unpooled.copiedBuffer("QOTM?", CharsetUtil.UTF_8),
SocketUtils.socketAddress("255.255.255.255", PORT))).sync();
// QuoteOfTheMomentClientHandler will close the DatagramChannel when a
// response is received. If the channel is not closed within 5 seconds,
// print an error message and quit.
if (!ch.closeFuture().await(5000)) {
System.err.println("QOTM request timed out.");
}
} finally {
group.shutdownGracefully();
}
}
}
Source
Frequently Asked Questions
What is the QuoteOfTheMomentClient class?
QuoteOfTheMomentClient is a class in the netty codebase, defined in example/src/main/java/io/netty/example/qotm/QuoteOfTheMomentClient.java.
Where is QuoteOfTheMomentClient defined?
QuoteOfTheMomentClient is defined in example/src/main/java/io/netty/example/qotm/QuoteOfTheMomentClient.java at line 36.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free