MediaWiki REL1_39
UDPTransport Class Reference

A generic class to send a message over UDP. More...

Public Member Functions

 __construct ( $host, $port, $domain, $prefix=false)
 
 emit ( $text)
 

Static Public Member Functions

static newFromString ( $info)
 

Public Attributes

const MAX_PAYLOAD_SIZE = 65507
 

Detailed Description

A generic class to send a message over UDP.

If a message prefix is provided to the constructor or via UDPTransport::newFromString(), the payload of the UDP datagrams emitted will be formatted with the prefix and a single space at the start of each line. This is the payload format expected by the udp2log service.

Since
1.25

Definition at line 33 of file UDPTransport.php.

Constructor & Destructor Documentation

◆ __construct()

UDPTransport::__construct ( $host,
$port,
$domain,
$prefix = false )
Parameters
string$hostIP address to send to
int$portport number
int$domainAF_INET or AF_INET6 constant
string | bool$prefixPrefix to use, false for no prefix

Definition at line 44 of file UDPTransport.php.

Member Function Documentation

◆ emit()

UDPTransport::emit ( $text)
Parameters
string$text

Definition at line 81 of file UDPTransport.php.

◆ newFromString()

static UDPTransport::newFromString ( $info)
static
Parameters
string$infoIn the format of "udp://host:port/prefix"
Returns
UDPTransport
Exceptions
InvalidArgumentException

Definition at line 56 of file UDPTransport.php.

Referenced by MediaWiki\Logger\LegacyLogger\emit().

Member Data Documentation

◆ MAX_PAYLOAD_SIZE

const UDPTransport::MAX_PAYLOAD_SIZE = 65507

Definition at line 35 of file UDPTransport.php.


The documentation for this class was generated from the following file: