RSSAmplifier

Blog

silicon_sprawl_

siliconsprawl.comRSS feed ↗12 posts

Latest posts

Connected UDP Sockets and ICMP Errors

UDP sockets can be created as connected or unconnected. This is purely a local convenience and has no bearing on the underlying protocol - it’s the same connectionless UDP protocol either way. A connected UDP socket is just a way to say “this socket will always send to and receive from remote address FOO”, thus letting you use the simpler send()/recv() syscalls instead of…

FIN_WAIT_2

Many people are familiar with the 3-way handshake used to establish TCP, but may not be as familiar with the 4-way (occasionally 3-way) handshake used to close a TCP connection, ie. the bottom left section of this diagram: The happy case for shutting down a connection is that the client sends a FIN to the server and receives an ACK, then receives a FIN from the server and sends an ACK.

Detecting Hangup

Let’s suppose you create a TCP connection but may not use it for some time, for example in a preconnected pool of TCP connections. When you eventually go to use it, there’s a possibility that the other end has already decided to hang up and close the connection - at which point you’d like to either pull another connection, establish an entirely fresh connection, or take some…

RecordStream

Note: this post is a historical relic, originally written in 2014. This is a tutorial introduction to RecordStream , half-heartedly adapted from a presentation I gave at SeaGL 2013 some months ago. Recs is the best ideas of Microsoft’s PowerShell applied to the Unix environment. It’s a collection of scripts for lightweight, ad-hoc data analysis based around a common internal…

Rust emit=asm Can Be Misleading

The short version Cargo builds like: $ RUSTFLAGS= "--emit asm" cargo build --release $ cargo rustc --release -- --emit asm Do not always output assembly equivalent to the machine code you’d get from: $ cargo build --release Possibly rustc --emit=asm has some uses, like examining a single file with no external dependencies, but it’s not useful for my normal case of wanting to look at…

Rust Ray Tracer, an Update (and SIMD)

About a month ago I ported my C99 ray tracer side project to Rust. The initial port went smoothly, and I’ve now been plugging away adding features and repeatedly rewriting it in my spare hours. In parallel I’m getting up to speed on a large, production Rust codebase at work. The contrast between the two has been interesting - I have almost entirely positive things to say about Rust for…

Porting a C99 Ray Tracer to Rust

I needed to pick up Rust for work, so I ported my existing ray tracer to the language for a little practice. It’s now in the unimaginatively named ecl_rt . Overall it was a pleasant experience. I particularly like Rust’s object system (am I allowed to call it that?), the bounded generics, how it handles numeric primitives (requiring explicit conversion, giving easy, explicit control of…

DLX Redux

Note: this post was from a college side project circa 2010. It held up fairly well, so I'm reposting it as-is. You've been warned. I was never all that interested in working Sudokus by hand. I've known a few people who were straight up addicted to it, but I never understood the draw. To me, games become much less fun when I know that a relatively straightforward method of solving them exists. It's…

Learning About Ray Tracing

I’ve had more time than usual for side projects since I’ve been stuck inside the past few months. I spent the majority of June digging into graphics, getting acquainted with the field by building a ray tracer. The initial version is now online as ecl_rt . Rather than write yet another post about building a ray tracer, I’ll point to the handful of resources (from the multitude…

Building Pipelines with Circular Buffers, not Queues

Structuring programs as pipelines is a nice way to separate business logic and introduce parallelism - if you do it right it gets you both clarity and performance. Typically this is done by tying threads together with some form of concurrent queue, such as a channel in Golang, ConcurrentLinkedQueue in Java, or concurrent_queue in C++ (Intel TBB or Microsoft PPL). Using a simple integer pipeline as…

Fast Subnet Matching

Determining if a subnet contains a given IP is a fundamental operation in networking. Router dataplanes spend all of their time looking up prefix matches to make forwarding decisions, but even higher layers of application code need to perform this operation - for example, looking up a client IP address in a geographical database or checking a client IP against an abuse blocklist. Routers have…

Network Programming Self-Study

Lately I’ve been getting more questions about how to start out in network programming: what books to read, what projects to do, and how to make a career of it. I’ve been in this space ten years now, working across layers 3 to 7 on CDNs, DNS, and protocol stacks at a couple of FAANGs and a startup. If you name a piece of software that runs in an edge network, I’ve probably seen…