我使用 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));
}
我得到 TXT 和 SRV 记录。SRV 记录的格式是inventory._itxpt_http._tcp.local 120 CLASS32769 SRV 0 0 8090 Android-2.local
.
如何更改当前格式?我想在服务名称(库存)之后删除 DOT,我希望它看起来像这样:inventory_itxpt_http._tcp.local 120 CLASS32769 SRV 0 0 8090 Android-2.local