Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg



PHP : Function Reference : Socket Functions : socket_shutdown

socket_shutdown

Shuts down a socket for receiving, sending, or both (PHP 4 >= 4.0.7, PHP 5)
bool socket_shutdown ( resource socket [, int how] )

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

Parameters

socket

A valid socket resource created with socket_create().

how

The value of how can be one of the following:

Table 300. possible values for how

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


Return Values

Returns TRUE on success or FALSE on failure.

Code Examples / Notes » socket_shutdown

richard dot thomas

That is not a good example of a graceful shutdown. One should close the sending side of the socket and continue to read until the remote end closes its sending connection.

ludvig dot ericson

Sockets should be first shutdown and then closed.
<?php
// Sample: Closing sockets gracefully
socket_shutdown($sock, 2);
socket_close($sock);
?>


Change Language


Follow Navioo On Twitter
socket_accept
socket_bind
socket_clear_error
socket_close
socket_connect
socket_create_listen
socket_create_pair
socket_create
socket_get_option
socket_getpeername
socket_getsockname
socket_last_error
socket_listen
socket_read
socket_recv
socket_recvfrom
socket_select
socket_send
socket_sendto
socket_set_block
socket_set_nonblock
socket_set_option
socket_shutdown
socket_strerror
socket_write
eXTReMe Tracker