I have a while loop for retrying to connect to a device. problem is, every time it does retry it is using the same socket descriptor(closing and opening again), is this safe?
while(retry)
create socket
read(use socket created before)
if read fails
close socket and retry
i want a new socket fd to connect with the server and read again. Is reusing the same one safe in case read has failed?