zkSockClose - close a socket descriptor
#include "zkSysSocket.h"
int
zkSockClose(int
socket);
The zkSockClose() function will deallocate the socket descriptor indicated by socket. To deallocate means to make the socket descriptor available for return by subsequent calls to zkSocket() or other functions that allocate socket descriptors.
If zkSockClose() is interrupted by a signal that is to be caught, it will return -1 with errno set to [EINTR] and the state of socket is unspecified.
If socket refers to a socket, zkSockClose() causes the socket to be destroyed. If the socket is connection-mode, and the SO_LINGER option is set for the socket with non-zero linger time, and the socket has untransmitted data, then zkSockClose() will block for up to the current linger interval until all data is transmitted.
Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error.
The zkClose() function will fail if:
- [EBADF]
- The socket argument is not a valid file descriptor.
- [EINTR]
- The zkClose() function was interrupted by a signal.
The zkClose() function may fail if:
- [EIO]
- An I/O error occurred while reading from or writing to the socket.
The zkSockClose() function may portably be used only with descriptors representing sockets. Any attempt to use it on a file, directory, FIFO, STREAMS file, terminal device file, character special file, or block special file is non-portable.