Extended maintenance of Ruby versions 1.8.7 and 1.9.2 ended on July 31, 2014. Read more

In Files

  • resolv.rb



SRV resource record defined in RFC 2782

These records identify the hostname and port that a service is available at.





The port on this target host of this service.

The range is 0-65535.


The priority of this target host.

A client MUST attempt to contact the target host with the lowest-numbered priority it can reach; target hosts with the same priority SHOULD be tried in an order defined by the weight field. The range is 0-65535. Note that it is not widely implemented and should be set to zero.


The domain name of the target host.

A target of "." means that the service is decidedly not available at this domain.


A server selection mechanism.

The weight field specifies a relative weight for entries with the same priority. Larger weights SHOULD be given a proportionately higher probability of being selected. The range of this number is 0-65535. Domain administrators SHOULD use Weight 0 when there isn’t any server selection to do, to make the RR easier to read for humans (less noisy). Note that it is not widely implemented and should be set to zero.

Public Class Methods

new(priority, weight, port, target) click to toggle source

Create a SRV resource record.

See the documentation for priority, weight, port and target for priority, weight, +port and target respectively.

               # File resolv.rb, line 2044
def initialize(priority, weight, port, target)
  @priority = priority.to_int
  @weight = weight.to_int
  @port = port.to_int
  @target = Name.create(target)

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.