【问题标题】:Error in implementing the UPnP iOS sample?实现 UPnP iOS 示例时出错?
【发布时间】:2014-11-14 11:08:17
【问题描述】:

我致力于 iOS 中的 UPnP 设备实现,我已经从 here 下载了源代码。使用该示例,我能够发现网络上的 UPnP 设备,但是当我尝试获取设备的描述时,我遇到了问题。我没有更改默认代码中的任何内容,但我仍然遇到了这个问题。

请求:

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body><u:GetSortCapabilities xmlns:u="urn:schemas-upnp-org:service:ContentDirectory:1">
</u:GetSortCapabilities></s:Body></s:Envelope>

回应:

错误(SoapAction):得到非 200 响应:500。数据:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Client</faultcode>
<faultstring>UPnPError</faultstring><detail>
<u:UPnPError xmlns:u="urn:schemas-upnp-org:control-1-0">
<u:errorCode>801</u:errorCode>
<u:errorDescription>Access denied</u:errorDescription>
</u:UPnPError></detail>
</SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>

谁能建议我如何解决这个问题?

【问题讨论】:

  • 这可能不是编程问题:您尝试使用的设备只是不允许随机客户端访问。尝试阅读该设备的文档,可能有例如一种将客户“列入白名单”的方法。或者,使用没有此“功能”的设备进行测试。

标签: ios upnp upnpx


【解决方案1】:

不确定这是否能解决您的问题,但就在几天前,我发现 Windows 中的默认换行符是“\r\n”(ascii 13 和 10),而 iOS 中的默认换行符是“\n "(仅限 ascii 10)。

这导致一些 UPnP 实现不响应我的搜索请求。 UPnP 标准通常需要“\r\n”作为换行符。您可能想查看实际字节,看看 13 和 10 是否总是在一起,或者您是否只得到 10。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-03-29
    • 2014-11-16
    • 1970-01-01
    • 2012-03-28
    • 1970-01-01
    • 2022-11-21
    • 2020-12-01
    • 2017-10-02
    相关资源
    最近更新 更多