首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何更改SRV记录格式

如何更改SRV记录格式
EN

Stack Overflow用户
提问于 2021-03-07 23:01:13
回答 1查看 30关注 0票数 0

我使用NsdManager注册了服务:

代码语言:javascript
复制
    public void RegisterService(string serviceName, int port, Dictionary<string, string> attributes, string serviceType = "_itxpt_http._tcp.")
    {
        var serviceInfo = new NsdServiceInfo()
        {
            ServiceName = serviceName,
            Port = port,
            ServiceType = serviceType
        };

        if (attributes != null && attributes.Count > 0)
        {
            foreach (var keyValuePair in attributes)
            {
                serviceInfo.SetAttribute(keyValuePair.Key, keyValuePair.Value ?? string.Empty);
            }
        }

        NsdManager.RegisterService(serviceInfo, NsdProtocol.DnsSd, new ListenerWrapper(_eventLogger));
    }

我得到了TXT和SRV记录。SRV记录的格式为inventory._itxpt_http._tcp.local 120 CLASS32769 SRV 0 0 8090 Android-2.local

如何更改当前格式?我想删除服务名(inventory)后面的点,我想让它看起来像这样:inventory_itxpt_http._tcp.local 120 CLASS32769 SRV 0 0 8090 Android-2.local

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-03-08 04:23:17

除了你的问题在这里是离题的,因为它与编程无关之外,你不能“改变”SRV记录的格式。这些记录必须以"_service._protocol“格式作为前缀。

因此,不能将inventory._itxpt_http._tcp.local名称附加到SRV记录,因为它不符合规范(实际上,即使您首先删除inventory,服务部分也不是,因为服务部分通常是IANA服务列表中的一个标记)。有关SRV记录是如何设计、如何工作和如何使用的详细信息和解释,请参阅RFC2782。

inventory_itxpt_http._tcp.local的格式也不正确。

如果你能解释更多你的问题,以及为什么你想要这个SRV记录,因为你显然没有按照设计的方式使用它们,你可能会得到更好的回复,但可能不会出现在这个网站上,除非你从编程问题开始。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66517885

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档