stream: add a stream class abstracting BSD sockets