Refactor existing sock_exec() and socketpair_tcp() functions into their own