Deduplicate the code that performs the bind(2) call