Closes the socket and resets the file descriptor, address and port.
0 success or -1 on failure. On failure errno is set appropriately.
Errors: EBADF fd isn't a valid open file descriptor.
EINTR The close() call was interrupted by a signal; see signal(7).
EIO An I/O error occurred.
See Implementation
Closes the socket and resets the file descriptor, address and port.