Microsoft Control Point UPnP问题

编程入门 行业动态 更新时间:2024-10-28 12:17:17
本文介绍了Microsoft Control Point UPnP问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

您好,

我正在尝试使用Control Point API进行UPnP管理。 我的问题是IUPnPDeviceFinder没有检测到某些设备(我使用"用于UPnP的开发人员工具"进行比较)。它主要涉及互联网网关。例如,我的应用程序能够在Windows 7下检测我的网关,但在 Windows XP SP3下无法看到它。即使这个特殊问题看起来并不是非常重要,它看起来像我的真正问题:根据网关品牌/型号,似乎IUPnPDeviceFinder无法报告它,即使在Windows 10 1709下(其他设备,如媒体渲染器$ b) $ b是相关的列表)。 对于我的网关/ Windows SP3,我捕获了paquets并看到控制点之间的交易(我的应用程序和我的网关)很好。 Microsoft Control Point API实际上读取了我的网关的XML文档,但IUPnPDeviceFinder没有报告此设备。 我的应用程序是用C ++纯代码编写的。这是最简单的剪辑集:

I'm trying to use the Control Point API for UPnP management. My problem is that some devices are not detected by the IUPnPDeviceFinder (I use "Developer Tools For UPnP" to compare). It concerns mostly internet gateways. For example, my app is able to detect my gateway under Windows 7 but can't see it under Windows XP SP3. Even if this particular issue seems not very worying, it looks like my real problem: depending on the gateway brand/model, it seems that the IUPnPDeviceFinder is unable to report it, even under Windows 10 1709 (other devices such as media renderers are correclty listed). In the case of my gateway / Windows SP3, I captured the paquets and saw that the transaction between control points (my app and my gateway) is just fine. The Microsoft Control Point API actually read the XML document of my gateway but IUPnPDeviceFinder doesn't report this device. My app is writen in C++ pure code. Here is the simplest snipset:

#include <windows.h> #include <upnp.h> #include <iostream> int main(int argc, char* argv[]) { HRESULT hr = CoInitialize(NULL); // Single-thread apartment // Check... IUPnPDeviceFinder* pDeviceFinder; hr = CoCreateInstance( CLSID_UPnPDeviceFinder, NULL, CLSCTX_INPROC_SERVER, IID_IUPnPDeviceFinder, (void**) &pDeviceFinder ); // Check... IUPnPDevices* piuDevices; BSTR bstr = SysAllocString(L"upnp:rootdevice"); hr = pDeviceFinder->FindByType(bstr, 0, &piuDevices); pDeviceFinder->Release(); SysFreeString(bstr); // Check... // Enumeration IUnknown* pUnk; hr = piuDevices->get__NewEnum(&pUnk); piuDevices->Release(); // Check... IEnumUnknown* pieUn; hr = pUnk->QueryInterface(IID_IEnumUnknown, (void**) &pieUn); pUnk->Release(); // Check... IUnknown* piuItem; IUPnPDevice* pDev; while (pieUn->Next(1, &piuItem, NULL) == S_OK) { hr = piuItem->QueryInterface(IID_IUPnPDevice, (void**) &pDev); piuItem->Release(); // Check... hr = pDev->get_FriendlyName(&bstr); pDev->Release(); // Check... std::wcout << bstr << std::endl; SysFreeString(bstr); } pieUn->Release(); return 0; }

我没有显示函数返回的检查(为了清除)但我在原始代码中实现了它们,所以这不是问题。

I didn't show the checking of function returns (for the sake of brievety) but I implemented them in the original code, so that's not the problem.

如果有人可以帮我解决这个问题,我将非常感激。坦率地说,我接近认为这是Microsoft Control Point API本身的一个问题。

If someone can help me on this issue, I will be very grateful. To be frank, I'm close to think that's a problem inside the Microsoft Control Point API itself.

推荐答案

您好Emile _,

Hi Emile_,

感谢您在此处发帖。

>>如果有人可以帮我解决这个问题,我将非常感激。坦率地说,我接近认为这是Microsoft Control Point API本身的一个问题。

代码对我来说似乎不错。您是否检查了防火墙设置?

The code seems good to me. Have you check the firewall setting?

对于这种情况,您可以在以下论坛上将此案例发布给Microsoft。

For this case, you could post this case to Microsoft on this forum below.

developercommunity.visualstudio/

您的理解与合作将不胜感激。

Your understanding and cooperation will be grateful.

最好的问候,

Baron Bi

更多推荐

Microsoft Control Point UPnP问题

本文发布于:2023-11-08 02:37:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1568092.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Control   Microsoft   UPnP   Point

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!