linux测试upnp,UPnP linux新手入门

上次发了一篇关于UPnP的入门教程,也不算教程吧,就是介绍了一下新手该从哪里下手,但基本是基于Windows的。但是发现里面的例子好复杂,常常一个sample中一个文件就几百上K行代码,着实累。后来经郭大神介绍,去找了linux下的一个例子,感觉舒服多了,还是C看正清晰明了啊。

——————————————————————割——————————————————————————

首先可以到google搜一下gupnp,会发现这个网站https://live.gnome.org/GUPnP/ 这里有很多关于GUPnP的文档可以下载,这个可以选择下或者不下,最主要的是先把GUPnP这个库的源码下下来。如下图所示。

72efe771dcd822df78e11f3f06461f0d.png

点击here就跳转到下载页面了。你会看到一个下载列表,由于东西太多,所以在页面上搜索一下gupnp,结果如下图所示。

f694767dfac883c66b8b418318dba557.png

选择最后一个 gupnp/ ,进入到另一个下载列表里面,这里有gupnp的各个版本,一般就选最新的好来,我们选0.18版本。

1de28feb0017f57777d6fb2647384646.png

然后下一个页面是选择次版本号,也选最新的吧,0.18.4,然后点击最后一个下载就行了。

f3cc7a980f2c969dd887cd3567baec6f.png

下到本地以后,解压缩。然后从终端进入gupnp-0.18.4目录,里面有一个examples目录,那里面是一个upnp-light的小例子。但是并没有Makefile文件,但是有Makefile.am 和Makefile.in。退回到gupnp-0.18.4目录来,可以看到有一个configure的可执行程序,运行它,就可以用Makefile.in生成Makefile了,如下图所示。

e867a676d2d7729e6a7ada4b0488bb58.png

再进到examples目录底下,就可以发现有light-server 和 light-cilent可执行文件了。

先运行light-server,再运行light-client就可以看到效果,再结合light-server.c和light-client.c源代码就基本能弄清楚UPnP的大致工作流程了。

现在老张交给的工作就只剩下怎么把UPnP集成到现有的智能家居里面去了,囧

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
If you are experiencing problems with the Universal Plug and Play service, your computer might not be able to automatically detect the presence of other networked devices, such as PCs, printers, Internet access points and so on. That is where the UPnP Test application comes in. This simple program is designed to help you identify the issues that prevent the UPnP protocol from functioning correctly. Before you get your hopes up, you should know that this tool does not solve the detected problems, but only performs a series of tests to identify the possible causes. One advantage is that the application does not require installation, so your system registry is not affected in any way. The interface is compact and simple, comprising only two panels: one that displays the test type and its short description and the other for viewing which of the tests passed and which failed. The program can verify whether the operating system provides support for the UPnP service and allows you to check if the Simple Service Discovery Protocol (SSDP) and the UPnPHost services are running. It also verifies the connection between your network adapter and your router and the system's capacity to receive UPnP messages, as well as the router's capability to report an external IP address. One of the tests is designed to check if the Windows firewall service is blocking the traffic between your router and the system, thus preventing UPnP from working. The results can be copied to your clipboard by simply pressing a button and the tests can be redone easily. If you want to fix the detected issues, the link in the main interface can prove useful. In conclusion, UPnP Test is a simple tool for detecting problems related to device-to-device networking. However, it can only suggest possible reasons why the UPnP is not working, fixing the detected issues is totally up to you.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值