socket stream add some useful functions