Check success of socket setup calls and invalidate it in case of failure

Also shuts up analyzer warning about unused assignment