Add more robust socket creation/connection