close(2dn)
NAME
close − terminate a DECnet connection
SYNTAX
close (s)
int s;
ARGUMENTS
Input Arguments
s specifies a descriptor for a socket that has been returned by the socket or the accept call.
DESCRIPTION
The close call terminates an outstanding connection over a DECnet socket descriptor and deactivates the descriptor. When the last close is issued on that descriptor, all associated naming information and queued data are discarded. (The close call deletes a descriptor from the per-process object reference table. If this is the last reference to the underlying socket, the socket is deactivated.)
The effect of issuing a close call while unsent data is queued for a remote program depends on the value of the linger option set with the setsockopt call. If SO_LINGER is set, the close is delayed until all data is sent or acknowledged.
A close of all of a program’s descriptors is automatic when an exit call is issued, but because there is a limit on the number of active descriptors per program, the close call is necessary for programs that deal with many descriptors.
RETURN VALUE
If the call succeeds, a value of 0 is returned. If an error occurs, a value of −1 is returned. Additional error detail is specified in the external variable errno.
DIAGNOSTICS
[EBADF] The s argument is not a valid descriptor.