miniupnpc
upnp端口映射:
http://bbs.csdn.net/topics/70382968
UPnP端口映射实现过程(二)
http://blog.csdn.net/jiuaiwo1314/article/details/7656446
UPnP端口映射实现过程(一)
http://blog.csdn.net/jiuaiwo1314/article/details/7656427
如何实现W5200E01-M3中的UPnP(通用即插即用) 端口转发(三)
http://blog.csdn.net/wiznet2012/article/details/7693430
MiniUPnP download zone
http://miniupnp.tuxfamily.org/files/
a command line upnp client that will allow me to write scripts to enable and disable port forwarding on my router
upnpc -a `ifconfig wlan0 | grep "inet addr" | cut -d : -f 2 | cut -d " " -f 1` 4668 4668 TCP
upnpc -a `ifconfig wlan0 | grep "inet addr" | cut -d : -f 2 | cut -d " " -f 1` 4678 4678 UDP upnpc-static -a 192.168.99.40 4678 4678 UDP M-SEARCH * HTTP/1.1\r\n
HOST: 239.255.255.250:1900\r\n
ST: urn:schemas-upnp-org:device:InternetGatewayDevice:1\r\n
MAN: \"ssdp:discover\"\r\n
MX: 2\r\n\r\n HTTP/1.1 200 OK\r\n
Cache-Control: max-age=300\r\n
Date: Wed, 12 Mar 2014 10:06:19 GMT\r\n
Ext: \r\n
Location: http://192.168.99.1:1780/InternetGatewayDevice.xml\r\n
Server: POSIX UPnP/1.0 DD-WRT Linux/V24\r\n
ST: urn:schemas-upnp-org:device:InternetGatewayDevice:1\r\n
USN: uuid:40C596C5-9BF9-CB72-3586-660E4C29BD20::urn:schemas-upnp-org:device:InternetGatewayDevice:1\r\n\r\n soapbody
<?xml version=\"1.0\"?>\r\n
<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">
<s:Body>
<u:GetStatusInfo xmlns:u=\"urn:schemas-upnp-org:service:WANIPConnection:1\"></u:GetStatusInfo>
</s:Body></s:Envelope>\r\n
soappostheader
POST /control?WANIPConnection HTTP/1.1\r\n
Host: 192.168.99.1:1780\r\n
User-Agent: Ubuntu/12.04, UPnP/1.0, MiniUPnPc/1.9\r\n
Content-Length: 271\r\n
Content-Type: text/xml\r\n
SOAPAction: \"urn:schemas-upnp-org:service:WANIPConnection:1#GetStatusInfo\"\r\n
Connection: Close\r\n
Cache-Control: no-cache\r\n
Pragma: no-cache\r\n\r\n SOAP Response:
<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\r\n
<s:Body>\r\n
<u:GetStatusInfoResponse xmlns:u=\"urn:schemas-upnp-org:service:WANIPConnection:1\">\r\n
<NewConnectionStatus>Connected</NewConnectionStatus>\r\n
<NewLastConnectionError>ERROR_NONE</NewLastConnectionError>\r\n
<NewUptime>451042</NewUptime>\r\n
</u:GetStatusInfoResponse>\r\n
</s:Body>\r\n
</s:Envelope>\r\n <s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\r\n
<s:Body>\r\n
<u:GetExternalIPAddressResponse xmlns:u=\"urn:schemas-upnp-org:service:WANIPConnection:1\">\r\n
<NewExternalIPAddress>192.168.110.83</NewExternalIPAddress>\r\n
</u:GetExternalIPAddressResponse>\r\n
</s:Body>\r\n
</s:Envelope>\r\n (gdb) p *urls
$20 = {controlURL = 0x8113830 "http://192.168.99.1:1780/control?WANIPConnection",
ipcondescURL = 0x81137e0 "http://192.168.99.1:1780/x_wanipconnection.xml",
controlURL_CIF = 0x8113880 "http://192.168.99.1:1780/control?WANCommonInterfaceConfig",
controlURL_6FC = 0x8113718 "http://192.168.99.1:1780/", rootdescURL = 0x81138e0 "http://192.168.99.1:1780/InternetGatewayDevice.xml"} AddPortMapping
<?xml version=\"1.0\"?>\r\n
<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">
<s:Body>
<u:AddPortMapping xmlns:u=\"urn:schemas-upnp-org:service:WANIPConnection:1\">
<NewRemoteHost></NewRemoteHost>
<NewExternalPort>4678</NewExternalPort>
<NewProtocol>UDP</NewProtocol>
<NewInternalPort>4678</NewInternalPort>
<NewInternalClient>192.168.99.48</NewInternalClient>
<NewEnabled>1</NewEnabled>
<NewPortMappingDescription>libminiupnpc</NewPortMappingDescription>
<NewLeaseDuration>0</NewLeaseDuration>
</u:AddPortMapping>
</s:Body>
</s:Envelope>\r\n 重复添加错误的相应:
<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring>UPnPError</faultstring>
<detail>
<UPnPError xmlns=\"urn:schemas-upnp-org:control-1-0\">
<errorCode>402</errorCode>
<errorDescription>Invalid Argument</errorDescription>
</UPnPError>
</detail>
</s:Fault>
</s:Body>
</s:Envelope> GetSpecificPortMappingEntry:
<?xml version=\"1.0\"?>\r\n
<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">
<s:Body>
<u:GetSpecificPortMappingEntry xmlns:u=\"urn:schemas-upnp-org:service:WANIPConnection:1\">
<NewRemoteHost></NewRemoteHost>
<NewExternalPort>4678</NewExternalPort>
<NewProtocol>UDP</NewProtocol>
</u:GetSpecificPortMappingEntry>
</s:Body>
</s:Envelope> <s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\r\n
<s:Body>\r\n
<u:GetSpecificPortMappingEntryResponse xmlns:u=\"urn:schemas-upnp-org:service:WANIPConnection:1\">\r\n
<NewInternalPort>4678</NewInternalPort>\r\n
<NewInternalClient>192.168.99.40</NewInternalClient>\r\n
<NewEnabled>1</NewEnabled>\r\n
<NewPortMappingDescription>libminiupnpc</NewPortMappingDescription>\r\n
<NewLeaseDuration>0</NewLeaseDuration>\r\n
</u:GetSpecificPortMappingEntryResponse>\r\n
</s:Body>\r\n
</s:Envelope>
可以在谷歌上这样搜索关键字:upnp port forwarding c
miniupnp官网
http://miniupnp.tuxfamily.org/files/ java版本的upnp端口映射:
http://upnp-portmapper.sourceforge.net/
java -jar PortMapper-1.9.6.jar -h
usage: java -jar PortMapper.jar [-a <ip port external_port protocol> | -d
<external_port protocol [...]> | -g | -h | -l | -r <port protocol [...]>
| -s] [-i <index>] [-u <class name>]
-a <ip port external_port protocol> Add port forwarding
-d <external_port protocol [...]> Delete port forwarding
-g Start graphical user interface (default)
-h print this message
-i <index> Router index (if more than one is found)
-l List forwardings
-r <port protocol [...]> Add all forwardings to the current host
-s Get Connection status
-u <class name> UPnP library
Protocol is UDP or TCP
UPnP library class names:
- org.chris.portmapper.router.sbbi.SBBIRouterFactory (default)
- org.chris.portmapper.router.weupnp.WeUPnPRouterFactory
- org.chris.portmapper.router.dummy.DummyRouterFactory
miniupnpc的更多相关文章
- 【转】使用miniupnpd-->upnp协议 映射本地端口到外网
miniupnpc的主要函数介绍 1>.miniupnpc库主要使用的头文件有 #include"miniwget.h" #include"miniupnpc.h& ...
- Tether USDT 节点钱包的安装与使用-omni layer
1 什么是Omni Layer Omni Layer是一种通信协议,它使用比特币区块链实现智能合约,用户货币和分散式点对点交换等功能. Omni Core是基于比特币核心代码库的快速,便携式Omni层 ...
- 为Ubuntu 安装Transmission 2.90
Transmission 是 Ubuntu 的默认 BitTorrent 客户端,近期发布了最新的 Transmission 2.90 版本,目前已经可通过 PPA 为 Ubuntu 15.10.Ub ...
- Solidity 官方文档中文版 3_安装Solidity
基于浏览器的Solidity 如果你只是想尝试一个使用Solidity的小合约,你不需要安装任何东西,只要访问 基于浏览器的Solidity http://remix.ethereum.org/. 如 ...
- Ubuntu上搭建比特币运行环境
Ubuntu版本:16.04.3 Bitcoin Core版本:0.16 1. 比特币运行依赖的开源库 (1)必须依赖的库 库 目的 描述 libssl 加密 随机数生成,椭圆曲线加密算法 libbo ...
- Solidity 文档--第二章:安装 Solidity
安装Solidity 基于浏览器的Solidity 如果你只是想尝试一个使用Solidity的小合约,你不需要安装任何东西,只要访问基于浏览器的Solidity. 如果你想离线使用,你可以保存页面到本 ...
- solidity代码
http://www.tryblockchain.org/ 教你如何舒服的看solidity代码 最近智能合约随着区块链技术的发展越发收到广大技术人员的重视! 其中最被看好的以太坊就是一个提供智能合约 ...
- op应用:官方,wifidog,portal,uci,luci,脚本,框架,usb
http://wiki.openwrt.org/doc/starthttp://downloads.openwrt.org/docs/buildroot-documentation.htmlhttp: ...
- Arch系统软件列表
1. 安装统计 2. 安装列表 3. 安装说明 4. 作为依赖项的安装列表 5. 更正 mangaro使用减的方式安装系统.开箱即用的豪华版本,大部分人需要的都有了,同样包括个别用户不需要的,配置方面 ...
随机推荐
- Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) D. Bear and Two Paths 构造
D. Bear and Two Paths 题目连接: http://www.codeforces.com/contest/673/problem/D Description Bearland has ...
- 几张图理解Roll, Pitch, Yaw的含义
Roll:翻滚 Pitch:俯仰 Yaw:偏航 有时候不知道它到底绕着哪个轴旋转得到的角,一个比较容易的记法是根据字母的排列顺序PRY分别对应XYZ轴进行旋转得到的角,即: Pitch是绕 ...
- Git_操作标签
如果标签打错了,也可以删除: $ git tag -d v0.1 Deleted tag 'v0.1' (was e078af9) 因为创建的标签都只存储在本地,不会自动推送到远程.所以,打错的标签可 ...
- TASKER 手机在有同一个号码的三个未接电话时自动回复短信
http://tieba.baidu.com/p/3695018030 感谢默默为Tasker吧奉献的人! 配置为>未接来电 任务为>代码>javascriptlet 代码为: va ...
- Android 脚本设计之 SL4A
SL4A的全称为Scripting Layer for Android, 顾名思义就是Android的脚本架构层,它的目的就是可以用熟知的脚本开发语言来开发Android应用程序.其工作原理基于RPC ...
- jquery的closest方法和parents方法的区别
今天第一次看到closest方法,以前也从来没用过. 该方法从元素本身开始往上查找,返回最近的匹配的祖先元素. 1.closest查找开始于自身,parents开始于元素父级 2.closest向上查 ...
- 用Parallel.For()和Parallel.For<TLocal>()方法实现并行运行迭代
Parallel类是.NET 4中新增的抽象线程类.如果你开发用的是VS2008或更低版本,那么就直接关闭吧,下面两个示例用了匿名委托,如果不知道匿名委托的语法,那么先去简单了解一下,不然很难理解示例 ...
- failed to get the task for process XXX(解决方案)
引人: iOS真机调试程序,报如下错误信息: failed to get the task for process XXX 原因: 证书问题,project和targets的证书都必须是开发证书,AD ...
- 转: "SMTP 服务器无法识别在 Mac 2011 Outlook 中发送电子邮件时错误。错误 17092"
在 Mac 2011 Outlook 中发送电子邮件时,您可能会收到下面的错误消息: 无法发送邮件.SMTP 服务器无法识别任何 Outlook 所支持的身份验证方法.请尝试更改帐户设置中的 SMTP ...
- Quartz Job执行后再更新Job的时间表达式....
CronTrigger 表达式最大循环时间是1年?那么实际应用中的提醒超过1年怎么办呢? 先看一下界面: 参数说明:提前提醒时间:1-60分钟.1-24小时.1-90天:重复提醒:每1-59分钟.每1 ...