Small subset of the netstring library from Ocamlnet