Aborts any connections and releases the data in the socket.
#include <sys/kern_socket.h>
int kern_soclose( ksocket _t so )
| Item | Description |
|---|---|
| so | The socket on which the close will be issued. |
The kern_soclose kernel service aborts any connection and releases the data in the socket.
The kern_soclose kernel service can be called from the process environment.
ksocket_t so;
int rc;
rc = kern_socreate(AF_INET, &so, SOCK_STREAM, IPPROTO_TCP);
if (rc != 0 )
{
return(-1);
}
/* Socket is in use */
...
kern_soclose(so);
| Item | Description |
|---|---|
| 0 | Upon Success |
| >0 | Error |
The nonzero return value is the error number that is defined in the /usr/include/sys/errno.h file.