MediaWiki REL1_33
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)
 

Private Attributes

 $domain
 
 $host
 
 $port
 
 $prefix
 

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 31 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 40 of file UDPTransport.php.

References $host, and port().

Member Function Documentation

◆ emit()

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

Definition at line 77 of file UDPTransport.php.

References port().

◆ newFromString()

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

Definition at line 52 of file UDPTransport.php.

References $host.

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

Member Data Documentation

◆ $domain

UDPTransport::$domain
private

Definition at line 32 of file UDPTransport.php.

◆ $host

UDPTransport::$host
private

Definition at line 32 of file UDPTransport.php.

Referenced by __construct(), and newFromString().

◆ $port

UDPTransport::$port
private

Definition at line 32 of file UDPTransport.php.

◆ $prefix

UDPTransport::$prefix
private

Definition at line 32 of file UDPTransport.php.


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