update exception handling for creating socket