GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
SHUTDOWN(2) FreeBSD System Calls Manual SHUTDOWN(2)

shutdown
disable sends and/or receives on a socket

Standard C Library (libc, -lc)

#include <sys/types.h>
#include <sys/socket.h>

int
shutdown(int s, int how);

The shutdown() system call disables sends or receives on a socket. The how argument specifies the type of shutdown. Possible values are:
Further receives will be disallowed.
Further sends will be disallowed. This may cause actions specific to the protocol family of the socket s to happen; see IMPLEMENTATION NOTES.
Further sends and receives will be disallowed. Implies SHUT_WR.

If the file descriptor s is associated with a SOCK_STREAM socket, all or part of the full-duplex connection will be shut down.

The following protocol specific actions apply to the use of SHUT_WR (and potentially also SHUT_RDWR), based on the properties of the socket associated with the file descriptor s.
Domain Type Protocol Action
Failure, as socket is not connected.
Failure, as socket is not connected.
Send queued data and tear down association.
Send queued data, wait for ACK, then send FIN.
Failure, as socket is not connected.
Failure, as socket is not connected.
Send queued data and tear down association.
Send queued data, wait for ACK, then send FIN.

The shutdown() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error.

The shutdown() system call fails if:
[]
The s argument is not a valid file descriptor.
[]
The how argument is invalid.
[]
The s argument specifies a socket which is not connected.
[]
The s argument does not refer to a socket.

connect(2), socket(2), inet(4), inet6(4)

The shutdown() system call is expected to comply with IEEE Std 1003.1g-2000 (“POSIX.1g”), when finalized.

The shutdown() system call appeared in 4.2BSD. The SHUT_RD, SHUT_WR, and SHUT_RDWR constants appeared in IEEE Std 1003.1g-2000 (“POSIX.1g”).

This manual page was updated by Bruce M. Simpson <bms@FreeBSD.org> to reflect how shutdown() behaves with PF_INET and PF_INET6 sockets.

The ICMP “port unreachable” message should be generated in response to datagrams received on a local port to which s is bound after shutdown() is called.
July 27, 2015 FreeBSD 13.1-RELEASE

Search for    or go to Top of page |  Section 2 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.