Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

socket_close

Description

The socket_close of Sockets for PHP closes a Socket.

Syntax

socket_close(
    Socket $socket
): void

Parameters

socket

A Socket instance created with socket_create() or socket_accept().

Return

No value is returned.

Examples

1 · socket

<?

$domain = AF_INET;
$type = SOCK_STREAM;
$protocol = SOL_TCP;

$socket = socket_create($domain, $type, $protocol);

    if($socket === false)
    {
        $error_code = socket_last_error();

        $socket_strerror = socket_strerror($error_code);

        die("socket_create: $socket_strerror");
    }

socket_close($socket);

?>
HomeMenu