Copyright (c) 2012 Apple Inc. All rights reserved.

@APPLE_OSREFERENCE_LICENSE_HEADER_START@

This file contains Original Code and/or Modifications of Original Code
as defined in and that are subject to the Apple Public Source License
Version 2.0 (the 'License'). You may not use this file except in
compliance with the License. The rights granted to you under the License
may not be used to create, or enable the creation or redistribution of,
unlawful or unlicensed copies of an Apple operating system, or to
circumvent, violate, or enable the circumvention or violation of, any
terms of an Apple operating system software license agreement.

Please obtain a copy of the License at
http://www.opensource.apple.com/apsl/ and read it before using this file.

The Original Code and all software distributed under the License are
distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
Please see the License for the specific language governing rights and
limitations under the License.

@APPLE_OSREFERENCE_LICENSE_HEADER_END@

.Dd November 14, 2012 .Dt DISCONNECTX 2 .Os Darwin .Sh NAME .Nm disconnectx .Nd disconnects a connection on a socket .Sh SYNOPSIS .Fd #include <sys/socket.h> .Ft int .Fo disconnectx .Fa "int socket" .Fa "associd_t associd" .Fa "connid_t connid" .Fc .Sh DESCRIPTION The parameter .Fa socket is a socket. The communication domain of the socket determines the availability and behavior of .Fn disconnectx . In general, .Fn disconnectx is analogous to .Xr shutdown 2 .Dv with SHUT_RDWR issued on the connection identified by .Fa connid , or on all connections associated with the .Fa associd association.

p The parameter .Fa associd specifies the association identifier. It may be set to .Dv ASSOCID_ANY when there is only one association present; .Dv ASSOCID_ALL to specify all existing associations; or one of the identifiers returned from .Xr getassocids 3 .

p The parameter .Fa connid specifies the connection identifier. It may be set to .Dv CONNID_ANY or .Dv CONNID_ALL , in which case the association represented by .Fa associd will be dissolved; or the value returned from .Xr connectx 2 or .Xr getconnids 3 , which indicates that the disconnection occurs only on that connection while keeping the session association intact. For the latter, the connection associated with .Fa connid will no longer be valid upon success. .Sh RETURN VALUES The .Fn disconnectx function returns the value 0 if successful; otherwise the value of -1 is returned and the global integer variable .Va errno is set to indicate the error. .Sh ERRORS The .Fn disconnectx system call succeeds unless: l -tag -width Er ===========
t Bq Er EALREADY Operation already in progress for the session association represented by .Fa associd . ===========
t Bq Er EBADF .Fa Socket is not a valid descriptor. ===========
t Bq Er EINVAL The .Fa associd or .Fa connid argument is invalid or the underlying protocol is no longer attached to .Fa socket . ===========
t Bq Er ENOTCONN The session association repreresented by .Fa associd is not connected. ===========
t Bq Er ENOTSOCK .Fa Socket is a file, not a socket. .El .Sh SEE ALSO .Xr connectx 2 , .Xr socket 2 , .Xr getassocids 3 , .Xr getconnids 3 , .Xr getconninfo 3 , .Xr compat 5 .Sh HISTORY The .Fn disconnectx function call appeared in Darwin 13.0.0