25 if ($this->stream !==
null) {
29 $host = strval($this->config[
"host"]);
30 $port = strval($this->config[
"port"]);
32 $address =
"udp://" . (str_contains($host,
":") ?
"[" . $host .
"]" : $host) .
":" . $port;
33 $timeout = (int)$this->config[
"timeout"];
35 $this->stream = @stream_socket_client($address, $errno, $errstr, $timeout);
37 if ($this->stream ===
false) {
38 throw new TransportException(StringHelper::factory($errstr)->toUtf8()->toString(), $errno);
41 @stream_set_timeout($this->stream, $timeout);
42 @stream_set_blocking($this->stream, $this->config[
"blocking"] ? 1 : 0);