# Working with SRV records

**URL:** <https://www.ruby-forum.com/t/working-with-srv-records/138315>\
**Category:** Ruby\
**Created:** [May 21, 2008, 11:41pm UTC](https://www.ruby-forum.com/t/working-with-srv-records/138315 "2008-05-21T23:41:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Darryl\_LSPierce](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a87d85/32.png) [@Darryl\_LSPierce](https://www.ruby-forum.com/u/Darryl_LSPierce)\
**Post date:** [May 21, 2008, 11:41pm UTC](https://www.ruby-forum.com/t/working-with-srv-records/138315/1 "2008-05-21T23:41:02Z")

</div>

On my current project at work I’ve been tasked with integrating LDAP  
into  
our user permissions system. A requirement is to determine the LDAP  
hostname using SRV records with a configured hostname as a fallback.

Anybody have experience or can point me to an example of retrieving a  
SRV  
record and the hostname for it?

---

<div class="post-metadata">

**Author:** ![Darryl\_LSPierce](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a87d85/32.png) [@Darryl\_LSPierce](https://www.ruby-forum.com/u/Darryl_LSPierce)\
**Post date:** [May 30, 2008, 4:13pm UTC](https://www.ruby-forum.com/t/working-with-srv-records/138315/2 "2008-05-30T16:13:43Z")

</div>

Darryl L. Pierce wrote:

> On my current project at work I’ve been tasked with integrating LDAP into  
> our user permissions system. A requirement is to determine the LDAP  
> hostname using SRV records with a configured hostname as a fallback.
> 
> Anybody have experience or can point me to an example of retrieving a SRV  
> record and the hostname for it?

I did finally get the answer to this question:

resolver = Resolv::DNS.new  
resolver.getresources("\_ldap.\_tcp.`dnsdomainname`,Resolv::DNS::Resource::IN:ANY).collect  
do |resource|

# process the resource

end
