If I create a socket
sockfd = socket(...);
and then I associate it to a FILE stream by calling
FILE* f=fdopen(sockfd,"r+");
Should I call both close(sockfd); and fclose(f); or only close(sockfd);? What happens to the FILE structure if I call or not fclose(f)?
And (the most important), if I should call both of them, in which order they must be called? First close() or fclose()?