Duplexstream

These are a bunch of changes to the DuplexStream code examples that make them make more sense to me, but I have no idea what I'm doing, so you might need to cherry-pick some of these if I changed things that shouldn't be changed.