added waitall flag for socket