add socket creation error handling