extracted socket setup for a new method