Code Explainers
Code explainers tagged #networking
java
public class TimedSocketReader { private static final int READ_TIMEOUT_MS = 5_000; private static final int CONNECT_TIMEOUT_MS = 3_000;
Reading a socket with connect and read timeouts
sockets
timeouts
io
Intermediate
8 steps
rust
use std::net::Ipv4Addr; use std::str::FromStr; #[derive(Debug, Clone, Copy)]
Parsing and matching IPv4 CIDR ranges in Rust
bitwise-operations
parsing
error-handling
Intermediate
8 steps
rust
use bytes::{Buf, BufMut, BytesMut}; use tokio_util::codec::{Decoder, Encoder}; const MAX_FRAME: usize = 8 * 1024 * 1024;
A length-prefixed frame codec in Tokio
framing
codecs
buffers
Intermediate
8 steps