vb.net bonjour 不设置 txtrecord 值
她是我尝试运行的代码:
Private NSRegistrar As New Bonjour.DNSSDService
Dim txtRecord As New Bonjour.TXTRecord
txtRecord.SetValue("publicKey", "ydy56dy65dy665yv65dvy65")
txtRecord.SetValue("privateKey", "ydy56dy65dy6fvaeva465yv65dvy65")
Console.WriteLine(txtRecord.GetValueForKey("publicKey"))
NSRegistrar = NSRegistrar.Register(0, 0, Environment.MachineName, "_secure._tcp", vbNullString, vbNullString, NSPort, txtRecord, NSEventManager)
一切正常,但是当我在另一台计算机上解析服务时,TXTRecord 根本不包含任何值。即使 Console.WriteLine 也不返回任何值。
有没有人成功地让 TXTRecords 在 vb.net 中与 bonjour 一起工作,或者有任何源代码可以分享?
Her is the code I am trying to run:
Private NSRegistrar As New Bonjour.DNSSDService
Dim txtRecord As New Bonjour.TXTRecord
txtRecord.SetValue("publicKey", "ydy56dy65dy665yv65dvy65")
txtRecord.SetValue("privateKey", "ydy56dy65dy6fvaeva465yv65dvy65")
Console.WriteLine(txtRecord.GetValueForKey("publicKey"))
NSRegistrar = NSRegistrar.Register(0, 0, Environment.MachineName, "_secure._tcp", vbNullString, vbNullString, NSPort, txtRecord, NSEventManager)
Everything works fine, but when I resolve the service on another machine, the TXTRecord contains no values at all. Even the Console.WriteLine returns no value.
Has anyone managed to get TXTRecords successfully working with bonjour in vb.net or have any source code they could share?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须将值作为 UTF-8 编码的字节数组传递:
我也遇到了同样的问题,并在 SDK 的 源代码。
You have to pass the value as UTF-8 encoded byte array:
I had the same problem too and found the solution in the SDK's source code.