Closes a connection and deletes a socket descriptor. The $QIO equivalent is the $DASSGN system service. Format #include <unixio.h> int close ( s );
1 – Argument
s A socket descriptor.
2 – Description
This function deletes a descriptor from the per-process object reference table. Associated TCP connections close first. If a call to connect() fails for a socket in connection mode, applications should use close() to deallocate the socket and descriptor. Related Functions See also accept(), socket(), and write().
3 – Return Values
0 Successful completion. -1 Error; errno is set to indicate the error.
4 – Errors
EBADF The socket descriptor is invalid. EINTR The close() function was interrupted by a signal that was caught.