Class Net::Ping::UDP
In: lib/net/ping/udp.rb
Parent: Ping

The Ping::UDP class encapsulates methods for UDP pings.

Methods

bind   data=   new   ping   ping?   pingecho   service_check   service_check=  

Constants

MAX_DATA = 64   The maximum data size that can be sent in a UDP ping.

Attributes

data  [R]  The data to send to the remote host. By default this is ‘ping’. This should be MAX_DATA size characters or less.

Public Class methods

Creates and returns a new Ping::UDP object. This is effectively identical to its superclass constructor.

Returns whether or not the connect behavior should enforce remote service availability as well as reachability. The default is true.

Set whether or not the connect behavior should enforce remote service availability as well as reachability. If set to false then Errno::ECONNREFUSED or Errno::ECONNRESET will be considered a successful ping, meaning no actual data handshaking is required. By default, if either of those errors occurs it is considered a failed ping.

Public Instance methods

Associates the local end of the UDP connection with the given host and port. This is essentially a wrapper for UDPSocket#bind.

Sets the data string sent to the remote host. This value cannot have a size greater than MAX_DATA.

Sends a simple text string to the host and checks the return string. If the string sent and the string returned are a match then the ping was successful and true is returned. Otherwise, false is returned.

ping?(host = @host)

Alias for ping

pingecho(host = @host)

Alias for ping

[Validate]