如何使用SRV记录自动查找服务器名称 [英] How to use an SRV record to automatically find a server name

查看:297
本文介绍了如何使用SRV记录自动查找服务器名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了在客户端-服务器模式下运行的代码.客户端向服务器发送查询,然后服务器进行响应.我正在使用命名管道.

这很好用,没有问题,但是仅在我提前知道服务器名称的情况下.

我想以某种方式使用DNS,而不是(a)在每个客户端上输入服务器的名称,或者(b)向网络上的每台计算机发送昂贵的查询以查找运行命名管道的服务器名称.我假设我需要在DNS服务器上有SRV记录,以便客户端可以查询DNS服务器以获取特定服务,并获取服务器的名称作为回报.

有人可以帮助或指向有关如何执行此操作的文章吗?我找不到任何文章显示如何执行此操作.

谢谢!

I have written code that runs in client-server mode. The client sends a query to the server, and the server responds back. I am using Named Pipes.

This works great and without issue, but only if I know the name of the server ahead of time.

Rather than (a)entering the name of the server on every client or (b)sending an expensive query to every computer on the network looking for the server name that is running the Named Pipe, I would like to somehow use DNS. I assume I need an SRV record on the DNS server so the clients can just query the DNS server for a particular service and get the name of the server in return.

Can someone help or point to an article on how to do this? I cannot find any articles that show how to do this.

Thank you!

推荐答案

首先,阅读此内容 [ ^ ],以了解SRV(服务)记录的工作方式.非常简单.

然后,您的应用只需在DNS中查找服务名称,它将获取IP信息以进行连接.
First, read this[^] to find out how an SRV (Service) record works. It''s surprisingly simple.

Your app then just has to lookup the service name in DNS and it''ll get back the IP information to connect to.


谢谢,所以我知道我可以使用nslookup或Win API DnsQuery.

现在,如何以编程方式将SRV记录添加到DNS服务器?
Thanks, so I see I can use nslookup or the Win API DnsQuery.

Now, how do I programatically add an SRV record to the DNS server?


这篇关于如何使用SRV记录自动查找服务器名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆