{"record":{"id":"523107640f182c9f","repo":"Seldaek/monolog","slug":"the-udpsocket-to-could-not-be-opened-via-soc","errorCode":null,"errorMessage":"The UdpSocket to {}:{} could not be opened via socket_create","messagePattern":"The UdpSocket to (.+?):(.+?) could not be opened via socket_create","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Monolog/Handler/SyslogUdp/UdpSocket.php","lineNumber":63,"sourceCode":"    {\n        if (null !== $this->socket) {\n            return $this->socket;\n        }\n\n        $domain = AF_INET;\n        $protocol = SOL_UDP;\n        // Check if we are using unix sockets.\n        if ($this->port === 0) {\n            $domain = AF_UNIX;\n            $protocol = IPPROTO_IP;\n        }\n\n        $socket = socket_create($domain, SOCK_DGRAM, $protocol);\n        if ($socket instanceof Socket) {\n            return $this->socket = $socket;\n        }\n\n        throw new \\RuntimeException('The UdpSocket to '.$this->ip.':'.$this->port.' could not be opened via socket_create');\n    }\n\n    protected function send(string $chunk): void\n    {\n        socket_sendto($this->getSocket(), $chunk, \\strlen($chunk), $flags = 0, $this->ip, $this->port);\n    }\n\n    protected function assembleMessage(string $line, string $header): string\n    {\n        $chunkSize = static::DATAGRAM_MAX_LENGTH - \\strlen($header);\n\n        return $header . Utils::substr($line, 0, $chunkSize);\n    }\n}\n","sourceCodeStart":45,"sourceCodeEnd":78,"githubUrl":"https://github.com/Seldaek/monolog/blob/57eb1028342134e701e77c617565d51b6e5a2a53/src/Monolog/Handler/SyslogUdp/UdpSocket.php#L45-L78","documentation":"Error \"The UdpSocket to {}:{} could not be opened via socket_create\" thrown in Seldaek/monolog.","triggerScenarios":"Thrown at src/Monolog/Handler/SyslogUdp/UdpSocket.php:63 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"57eb1028342134e701e77c617565d51b6e5a2a53","analyzedAt":"2026-08-17T02:36:30.259Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}