I faced few issues while writing server application using TCP on linux system. I have few queries.
- Where are socket FDs are stored and what are the attributes associated with socket FDs.
- How the kernel differentiates between FDs like socket FDs, file Fds, Message Queue FDs
Socket FDs are received as
int sockFD = socket(..., ..., ...);
what is the difference between
a) close(sockFD);
and
b) int sockCopy = sockFD; //copy the socketfd
close(sockCopy);
Case b will not close socket why?