1.\" 2.\" Copyright (c) 2015 Apple Inc. All rights reserved. 3.\" 4.\" @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5.\" 6.\" This file contains Original Code and/or Modifications of Original Code 7.\" as defined in and that are subject to the Apple Public Source License 8.\" Version 2.0 (the 'License'). You may not use this file except in 9.\" compliance with the License. The rights granted to you under the License 10.\" may not be used to create, or enable the creation or redistribution of, 11.\" unlawful or unlicensed copies of an Apple operating system, or to 12.\" circumvent, violate, or enable the circumvention or violation of, any 13.\" terms of an Apple operating system software license agreement. 14.\" 15.\" Please obtain a copy of the License at 16.\" http://www.opensource.apple.com/apsl/ and read it before using this file. 17.\" 18.\" The Original Code and all software distributed under the License are 19.\" distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20.\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21.\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22.\" FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23.\" Please see the License for the specific language governing rights and 24.\" limitations under the License. 25.\" 26.\" @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27.\" 28.Dd April 10, 2015 29.Dt DISCONNECTX 2 30.Os Darwin 31.Sh NAME 32.Nm disconnectx 33.Nd disconnects a connection on a socket 34.Sh SYNOPSIS 35.Fd #include <sys/socket.h> 36.Ft int 37.Fo disconnectx 38.Fa "int socket" 39.Fa "sae_associd_t associd" 40.Fa "sae_connid_t connid" 41.Fc 42.Sh DESCRIPTION 43The parameter 44.Fa socket 45is a socket. The communication domain of the socket determines the 46availability and behavior of 47.Fn disconnectx . 48For connection-oriented socket, 49.Fn disconnectx 50is analogous to 51.Xr shutdown 2 52.Dv with SHUT_RDWR 53issued on the socket. For connectionless socket, it disassociates any existing 54association to the peer socket. 55.\" identified by 56.\" .Fa connid , 57.\" or on all connections associated with the 58.\" .Fa associd 59.\" association. 60.Pp 61The parameter 62.Fa associd 63specifies the association identifier. It should be set to 64.Dv SAE_ASSOCID_ANY . 65.\"when there is only one association present; 66.\".Dv SAE_ASSOCID_ALL 67.\"to specify all existing associations; or one of the identifiers returned from 68.\".Xr getassocids 3 . 69.Pp 70The parameter 71.Fa connid 72should be set to 73.\" specifies the connection identifier. It may be set to 74.Dv SAE_CONNID_ANY . 75.\" or 76.\".Dv SAE_CONNID_ALL , 77.\" in which case the association represented by 78.\" .Fa associd 79.\" will be dissolved; or the value returned from 80.\" .Xr connectx 2 81.\" or 82.\" .Xr getconnids 3 , 83.\" which indicates that the disconnection occurs only on that connection 84.\" while keeping the session association intact. For the latter, the connection 85.\" associated with 86.\" .Fa connid 87.\" will no longer be valid upon success. 88.Sh NOTES 89.Fn disconnectx 90is currently supported only on AF_INET and AF_INET6 sockets of type SOCK_DGRAM 91and SOCK_STREAM. 92.Sh RETURN VALUES 93The 94.Fn disconnectx 95function returns the value 0 if successful; otherwise the value of -1 is 96returned and the global integer variable 97.Va errno 98is set to indicate the error. 99.Sh ERRORS 100The 101.Fn disconnectx 102system call succeeds unless: 103.Bl -tag -width Er 104.\" =========== 105.It Bq Er EALREADY 106Operation already in progress. 107.\" for the session association represented by 108.\" .Fa associd . 109.\" =========== 110.It Bq Er EBADF 111.Fa Socket 112is not a valid descriptor. 113.\" =========== 114.It Bq Er EINVAL 115The 116.Fa associd 117or 118.Fa connid 119argument is invalid or the underlying protocol is no longer attached to 120.Fa socket . 121.\" =========== 122.It Bq Er ENOTCONN 123.\" The session association repreresented by 124.\" .Fa associd 125.\" is not connected. 126The 127.Fa socket 128is not connected. 129.\" =========== 130.It Bq Er ENOTSOCK 131.Fa Socket 132is a file, not a socket. 133.El 134.Sh SEE ALSO 135.Xr connect 2 , 136.Xr connectx 2 , 137.Xr socket 2 , 138.\" .Xr getassocids 3 , 139.\" .Xr getconnids 3 , 140.\" .Xr getconninfo 3 , 141.Xr compat 5 142.Sh HISTORY 143The 144.Fn disconnectx 145function call appeared in Darwin 15.0.0 146