C#/。NET:确定服务器是否存在,查询SVC记录的DNS [英] C#/.NET: FInd out whether a server exists, Query DNS for SVC records

查看:158
本文介绍了C#/。NET:确定服务器是否存在,查询SVC记录的DNS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编写一个cleint / Server工具我有任务试图找到要连接的服务器。我希望为用户尽可能简单的做到这一点。因此,我的想法是:




  • CHeck是否存在特定的服务器(按名称编码)(如邮件mail.xxx)服务器,例如 - 我的exampüle不是邮件服务器;)

  • 否则查询DNS SVC记录,允许管理员配置特定服务的服务器位置(客户端连接到)



结果是用户可能只需输入一个域名,甚至可能甚至没有(使用注册的标准网络环境中的计算机域)。



任何人的想法如何:





  • Anyonw知道如何从一个特定的(默认)域中的ifint .NET最好的SVC记录问题?


    • 解决方案

      测试服务是否存在并处于活动状态的最佳方法可能是使用该服务的本机协议。否则我会用ping(ICMP ECHO)。



      至于查找SRV记录(我认为你的意思是SRVsinces没有SVC类型),您可以使用DNS客户端库for .NET( http:// www .simpledns.com / dns-client-lib.aspx ) - 例如:

        var Response = JHSoftware。 DnsClient.Lookup(_ ftp._tcp.xyz.com,
      JHSoftware.DnsClient.RecordType.SRV);


      Writing a cleint/Server tool I am tasked trying to find a server to connect to. I would love to make things as easy as possible for the user. As such, my idea is to:

      • CHeck whether specific servers (coded by name) exist (like "mail.xxx" for a mail server, for example - my exampüle is not a mail server;)
      • Query otherwise for DNS SVC records, allowing the admin to configure a server location for a specific serivce (that the client connects to).

      The result is that the user may have to enter only a domain name, possibly even not even that (using the registered standard domain of the computer in a LAN environment).

      Anyone ideas how:

      • To find out whether a server exists and answers (i.e. is online) in the fastest way? TCP can take a long time if the server is not there. A UDP style ping sounds like a good idea to me. PING itself may be unavailable.
      • Anyonw knows how to ask from withint .NET best for a SVC record in a specific (the default) domain?

      解决方案

      The best way to test if a service exists and is alive is probably using the native protocol of that service. Otherwise I would go with ping (ICMP ECHO).

      As for looking up the SRV-record (I assume you mean "SRV" sinces there is no "SVC" type), you could use the "DNS Client Library for .NET" (http://www.simpledns.com/dns-client-lib.aspx) - for example:

      var Response = JHSoftware.DnsClient.Lookup("_ftp._tcp.xyz.com", 
                                             JHSoftware.DnsClient.RecordType.SRV);
      

      这篇关于C#/。NET:确定服务器是否存在,查询SVC记录的DNS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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