shutdown man page on OpenBSD

Man page or keyword search:  
man Server   11362 pages
apropos Keyword Search (all sections)
Output format
OpenBSD logo
[printable version]

SHUTDOWN(2)		  OpenBSD Programmer's Manual		   SHUTDOWN(2)

NAME
     shutdown - disable sends or receives on a socket

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

     int
     shutdown(int s, int how);

DESCRIPTION
     The shutdown() system call disables sends or receives on a socket.

     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 how argument specifies the type of shutdown.  Possible values are:

	   SHUT_RD	 Further receives will be disallowed.

	   SHUT_WR	 Further sends will be disallowed.  This may cause
			 actions specific to the protocol family of the socket
			 s to happen.

	   SHUT_RDWR	 Further sends and receives will be disallowed.

     The following protocol specific actions apply to the use of SHUT_WR based
     on the properties of the socket associated with the file descriptor s:

	   DOMAIN      TYPE	      PROTOCOL	     RETURN VALUE AND ACTION

	   PF_INET     SOCK_DGRAM     IPPROTO_UDP    Return 0.	ICMP messages
						     will not be generated.
	   PF_INET     SOCK_STREAM    IPPROTO_TCP    Return 0.	Send queued
						     data, wait for ACK, then
						     send FIN.
	   PF_INET6    SOCK_DGRAM     IPPROTO_UDP    Return 0.	ICMP messages
						     will not be generated.
	   PF_INET6    SOCK_STREAM    IPPROTO_TCP    Return 0.	Send queued
						     data, wait for ACK, then
						     send FIN.

RETURN VALUES
     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.

ERRORS
     The shutdown() system call fails if:

     [EBADF]	   The s argument is not a valid file descriptor.

     [EINVAL]	   The how argument is invalid.

     [ENOTCONN]	   The s argument specifies a SOCK_STREAM socket which is not
		   connected.

     [ENOTSOCK]	   The s argument does not refer to a socket.

     [EOPNOTSUPP]  The socket associated with the file descriptor s does not
		   support this operation.

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

HISTORY
     The shutdown() function call appeared in 4.2BSD.  The SHUT_RD, SHUT_WR,
     and SHUT_RDWR constants appeared in IEEE Std 1003.1g-2000 (``POSIX'').

BUGS
     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.

OpenBSD 4.9			 May 31, 2007			   OpenBSD 4.9
[top]

List of man pages available for OpenBSD

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net