stream_socket_sendto

Supported Versions: PHP 5, PHP 7, PHP 8
Sends a message to a socket, whether it is connected or not
<?php stream_socket_sendto(    resource $socket,    string $data,    int $flags = 0,    string $address = ""): int|false
<?php             fwrite($client, $request);

            $response = fread($client, 65536);



            stream_socket_sendto($socket, $response, 0, $peer);

            ++$received;

            fclose($client);

        });
<?php         set_error_handler([self::class, 'nullErrorHandler']);

        try {

            if (-1 !== stream_socket_sendto($this->socket, $encodedPayload)) {

                return true;

            }

            if (!$socketIsFresh) {
<?php                 fclose($this->socket);

                $this->socket = $this->createSocket();

            }

            if (-1 !== stream_socket_sendto($this->socket, $encodedPayload)) {

                return true;

            }

        } finally {