Thank you for your reply.
If I call sock_connect with the MSG_DONTWAIT flag, how can I know the system has established the connection and that I can dispose of the to structure ?
I tried calling sock_connect with MSG_DONTWAIT, releasing the to structure, and I ended up with a kernel panic. If I don't dealloc the structure, everything is fine.