Microchip
直播中

赵媛

8年用户 153经验值
私信 关注
[问答]

帮助解决通过mDNS发布2个服务的方法

在我的应用程序中,我尝试使用MNS来为我的服务做广告。我按预期工作了。然而,我的应用程序必须做广告,超过1的服务,我知道,TCPIP栈不支持同时超过1个服务的广告。所以我尝试取消我的第一服务并注册下一个服务。我看到的问题是,我的第一个服务根本没有广告。我可以从Bojjor浏览器看到我的第二个服务,但第一个从来没有出现,虽然它最初是广告。即使在WiReSARK,我也看不到第一的服务广告。我认为这可能是一个时间问题,我甚至在完全广告之前取消了第一项服务。我试图在取消登记之前引入一些延迟,但没有运气。你能建议我能在一个接一个地发布我的服务吗?

以上来自于百度翻译


      以下为原文

    In my application, I'm trying to use MDNS to advertise my service. I got it working as expected. However my application has to advertise more than 1 service and I learnt that the TCPIP stack doesn't support advertising more than 1 service concurrently. So I tried deregistering my 1st service and register the next. The problem I see is, my 1st service never gets advertised at all. I can see my 2nd service from a Bonjour browser but the 1st one never shows up though it was advertised initially. Even in Wireshark, I don't see the 1st service advertisement. I thought this could be a timing issue and I was deregistering the 1st service even before it was completely advertised. I tried introducing some delays before the deregister but no luck. Can you suggest a workaround where I would be able to publish my services one after the other?

回帖(13)

云达贞

2019-3-15 13:35:45
现在,是的,每个接口只能注册一个服务。为了改变这一点,我没有看到一个即时的解决方案,因为您需要创建一个DNSRESUT的数组,每个都有自己的状态。不管怎样,你不是最好的主意。但是我想你的问题有一个解决方案:启用别名接口并在同一条线上创建另一个虚拟接口(我假设你运行以太网)。这个新的接口将有自己的IP地址,可以运行自己的MNS服务,为您提供您所需要的。

以上来自于百度翻译


      以下为原文

    Currently yes, there is only one service that can be registered per interface.
To change this I don't see an immediate workaround because you'd need to create an array of DNSDesc_t, each with its own state, etc. While this is not difficult to do, it still needs a lot of messing with the code, probably not the best idea anyway.
 
But there is a solution to your problem, I think: enable the alias interfaces and create another virtual interface on the same wire (I assume you run Ethernet). This new interface will have its own IP address and can run its own mDNS service, providing you what you need.
Give it a try and let us know.
 
 
举报

陈芳

2019-3-15 13:55:46
我应该在我的第一个帖子里提到这个。我在我的应用程序中使用IPv6,并且我还发现IPv6的接口别名是不支持的。你的建议是什么?

以上来自于百度翻译


      以下为原文

    I should have mentioned this in my initial post. I'm using IPv6 in my application and I see that interface aliasing is not supported for IPv6, yet. What would be your suggestion?
举报

云达贞

2019-3-15 14:10:57
MDNS只在IPv4之上,没有IPv6支持。也许您可以同时运行?

以上来自于百度翻译


      以下为原文

    mDNS is only over IPv4, no IPv6 support.
Maybe you can run both?
 
举报

陈芳

2019-3-15 14:18:57
是啊。进一步分析,我注意到,MDNS只是IPv4。你对我的申请是正确的,包括IPv4和IPv6。但是,在所有的事务中,我只在应用程序中使用IPv6地址。我会尝试混淆和宣传我的第二服务,让你知道它是怎么回事。谢谢你一直以来的帮助。

以上来自于百度翻译


      以下为原文

    Yeah. Analyzing further, I did notice that mDNS is only IPv4. You were right about my application including both IPv4 & IPv6. However, I use only IPv6 addresses in my application for all the transactions. I'll try the aliasing and advertise my 2nd service and let you know how it goes. Thank you for helping out all along.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分