ILIAS
release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
◀ ilDoc Overview
UdpSocket.php
Go to the documentation of this file.
1
<?php
2
3
/*
4
* This file is part of the Monolog package.
5
*
6
* (c) Jordi Boggiano <j.boggiano@seld.be>
7
*
8
* For the full copyright and license information, please view the LICENSE
9
* file that was distributed with this source code.
10
*/
11
12
namespace
Monolog\Handler\SyslogUdp
;
13
14
class
UdpSocket
15
{
16
const
DATAGRAM_MAX_LENGTH
= 65023;
17
18
public
function
__construct
($ip, $port = 514)
19
{
20
$this->ip = $ip;
21
$this->port = $port;
22
$this->socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
23
}
24
25
public
function
write
($line,
$header
=
""
)
26
{
27
$this->
send
($this->
assembleMessage
($line,
$header
));
28
}
29
30
public
function
close
()
31
{
32
socket_close($this->socket);
33
}
34
35
protected
function
send
($chunk)
36
{
37
socket_sendto($this->socket, $chunk, strlen($chunk), $flags = 0, $this->ip, $this->port);
38
}
39
40
protected
function
assembleMessage
($line,
$header
)
41
{
42
$chunkSize = self::DATAGRAM_MAX_LENGTH - strlen(
$header
);
43
44
return
$header
. substr($line, 0, $chunkSize);
45
}
46
}
Monolog\Handler\SyslogUdp
Definition:
UdpSocket.php:12
Monolog\Handler\SyslogUdp\UdpSocket\assembleMessage
assembleMessage($line, $header)
Definition:
UdpSocket.php:40
Monolog\Handler\SyslogUdp\UdpSocket\__construct
__construct($ip, $port=514)
Definition:
UdpSocket.php:18
$header
$header
Definition:
example_011.php:123
Monolog\Handler\SyslogUdp\UdpSocket
Definition:
UdpSocket.php:14
Monolog\Handler\SyslogUdp\UdpSocket\write
write($line, $header="")
Definition:
UdpSocket.php:25
Monolog\Handler\SyslogUdp\UdpSocket\close
close()
Definition:
UdpSocket.php:30
Monolog\Handler\SyslogUdp\UdpSocket\DATAGRAM_MAX_LENGTH
const DATAGRAM_MAX_LENGTH
Definition:
UdpSocket.php:16
Monolog\Handler\SyslogUdp\UdpSocket\send
send($chunk)
Definition:
UdpSocket.php:35
Services
Logging
lib
vendor
monolog
monolog
src
Monolog
Handler
SyslogUdp
UdpSocket.php
Generated on Wed Aug 27 2025 19:00:55 for ILIAS by
1.8.13 (using
Doxyfile
)