Do you need ``cf_closesocket(sd)`` before the return here?