simulator: fix TCP connection init on macOS
simulator: fix TCP connection init on macOS

When `connect()` fails, the state of the socket is unspecified and we
need to close the it and create it again.

It turns out retrying connect worked on Linux but it didn't on macOS.

PX4/Firmware,krbeverx/Firmware,krbeverx/Firmware,PX4/Firmware,dagar/Firmware,mje-nz/PX4-Firmware,acfloria/Firmware,mje-nz/PX4-Firmware,mje-nz/PX4-Firmware,dagar/Firmware,PX4/Firmware,krbeverx/Firmware,krbeverx/Firmware,dagar/Firmware,acfloria/Firmware,mje-nz/PX4-Firmware,dagar/Firmware,dagar/Firmware,krbeverx/Firmware,PX4/Firmware,acfloria/Firmware,PX4/Firmware,krbeverx/Firmware,dagar/Firmware,acfloria/Firmware,acfloria/Firmware,acfloria/Firmware,PX4/Firmware,PX4/Firmware,acfloria/Firmware,mje-nz/PX4-Firmware,mje-nz/PX4-Firmware,dagar/Firmware,krbeverx/Firmware,mje-nz/PX4-Firmware