ePages 6.17.52 - DE_EPAGES/Core/API/Object/UDPClient.pm

Package DE_EPAGES::Core::API::Object::UDPClient

UDP client class

Functions

new
receive
send
sendReceive

new

Creates a new UDPClient object.

Syntax
$UDPClient = DE_EPAGES::Core::API::Object::UDPClient->new( $Host, $Port );
Example
my $UDPClient = DE_EPAGES::Core::API::Object::UDPClient->new( 'servername', 10043 );
$UDPClient->send('Hello');
Input
$Host (string)
host name or IP address
$Port (int)
port number
Return
$UDPClient (DE_EPAGES::Core::API::Object::UDPClient)
UDPClient object

receive

Receives UDP messages

Syntax
my $Response = $UDPClient->receive( $TimeoutSec, $MaxLength );
Input
$TimeoutSec (float)
maximum time to wait for data in seconds (default 1.0)
$MaxLength (integer)
maximum length of the received data (default 8192)
Return
$Data (string)
received data or undef if none was received

send

Sends an UDP message containing $Data.

Syntax
$UDPClient->send( $Data );
Input
$Data (string)
bytes to send

sendReceive

Sends an UDP message containing $Data, then waits for and returns a response

Syntax
my $Response = $UDPClient->sendReceive( $Data, $TimeoutSec, $MaxLength );
Input
$Data (string)
bytes to send
$TimeoutSec (float)
maximum time to wait for a response in seconds (default 1.0)
$MaxLength (integer)
maximum length of the received data (default 8192)
Return
$Data (string)
received data or undef if none was received