Sockets secure implementations

Rebased on `master`.
add a comment stating & justifying the growth algorithm used here