0

I registered service using NsdManager:

    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));
    }

And I get TXT and SRV recods. Format of SRV record is inventory._itxpt_http._tcp.local 120 CLASS32769 SRV 0 0 8090 Android-2.local.

How can I change current format? I want to remove DOT after service name (inventory), I want it to look like this: inventory_itxpt_http._tcp.local 120 CLASS32769 SRV 0 0 8090 Android-2.local

Serlok
  • 432
  • 1
  • 10
  • 24

1 Answers1

0

Besides the fact that your question is offtopic here as not really related to programming, you can not "change" the format of an SRV record. These records have to be in the format "_service._protocol" as prefix.

As such inventory._itxpt_http._tcp.local name can not be attached to an SRV record as it does not follow the specification (neither is the service part in fact even if you remove inventory first, as the service part is normally a token among the IANA list of services). See RFC 2782 for further details and explanations on how an SRV record is designed and expected to work and be used.

inventory_itxpt_http._tcp.local is also not in correct format.

If you would explain more your problems and why you want this to SRV record as you obviously are not using them the way they are designed, you might get better replies, but probably not on this website except if you start with a programming question.

Patrick Mevzek
  • 10,995
  • 16
  • 38
  • 54
  • I think it is related, because I need a way to change format programmatically, so I need someone that had experience with nsd manager. Client made request to change format, so I am now investigating how to do it – Serlok Mar 08 '21 at 08:30
  • 1
    @Serlok It seems you missed the main important point of my answer, and I do recommend again you read RFC2782. By definition, an `SRV` record HAS TO BE in the format `_service._protocol` that is two labels both starting with an underscore, and then a service token being in the list of IANA allowed services, and a protocol being often just `tcp` or `udp`. Anything not following this format IS NOT an `SRV` record. – Patrick Mevzek Mar 08 '21 at 14:47
  • You are right, I had wrong idea in my head, thank you for explanation. – Serlok Mar 09 '21 at 07:05