added timeout and wait for succes for the setSocket function