Tombstone
AsyncSerialization
2002 โ 2003 ยท age 20โ21
What it was
The smallest possible object-passing socket layer, in about 400 lines of C# on .NET 1.0. A client wrapped a TCP connection, read asynchronously into a buffer, and whenever enough bytes had arrived to match a leading four-byte length, deserialized one object and handed it to a callback. Writing was the mirror image: serialize, prefix with the length, send. A server accepted connections on a thread, numbered them in a sorted list, and fanned the same events out. Both ends spoke through one four-method interface, IChannel: object arrived, connect, disconnect, close, so the application never saw a socket. A stress client fired 50,001 strings at a server that ignored every one of them. The library never grew a second message type or a real consumer.
Wins, for the age
- At twenty, wrote length-prefixed framing over async sockets and pushed fifty thousand messages through it, finding on its own the shape Java's object serialization over sockets (1997) had already taken.
- Designed one channel interface shared by client and server, a clean seam that is the one thing here worth keeping.
- Threaded the client itself through the async callbacks as its own state, avoiding per-read allocations in a runtime that had no lambdas yet.
- Built a stress pair to prove the loop rather than trusting it. The instinct to measure arrived early in this primate.
What it taught
- Framing is easy. Write ordering is not: asynchronous writes need a queue, or frames interleave on the wire.
- Exceptions as control flow cost more than they look. Every partial read here paid for one.
- Deserializing whatever the wire says is a security hole, even when the wire is your own LAN. In 2002 it looked like the obvious choice.
- A socket library should not depend on a GUI toolkit to report its errors.
Genealogy
Ancestors: File Sharing Accelerator: a client and server that moved data between peers. Zen Net: the first chat server and its client. ZenErd Overlapped Server: asynchronous sockets with a protocol "decided later". Znetfs: transfer over TCP with fair, resumable connections. Descendants: Adama Net: four-byte frames on one socket, grown up. Evolution eXPeriment: a client-server game over the same kind of connection. Play Workspace: one frame protocol that browser, gateway and server all agreed on.
Epitaph
Here lies AsyncSerialization. It framed objects on a socket well enough to send fifty thousand of them, and never sent anything else.