Winsock connect() function returns "success" but connection is not estabilished

Ethernet cable is unpluged from board.
First 10 times connect() returns non zero - error condition.
On the 11th time connect() returns 0 - indicates success.

while(connect(sock, (sockaddr *)&saiDestAddr, sizeof(saiDestAddr)) == SOCKET_ERROR) {
        #if DEBUG
        dbg.sndMsg("error", WSAGetLastError());
        dbg.sndMsg("try arain...");

Can you please check when this code returns connected if icon in the right bottom corner also shows connected.