php8.5
Home/ Manual/ sockets / functions/ socket_shutdown

socket_shutdown

PHP function Edit on GitHub ✎

(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)

Shuts down a socket for receiving, sending, or both

Description

socket_shutdown(Socket $socket, int $mode = 2): bool

The socket_shutdown() function allows you to stop incoming, outgoing or all data (the default) from being sent through the socket

Note

The associated buffer, or buffers, may or may not be emptied.

Parameters

socket

A Socket instance created with socket_create().

mode

The value of mode can be one of the following:

0Shutdown socket reading
1Shutdown socket writing
2Shutdown socket reading and writing

Return Values

Success

Changelog

VersionDescription

Source: reference/sockets/functions/socket-shutdown.xml · from the official PHP manual (php/doc-en)