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的更多相关文章

  1. 【转】使用miniupnpd-->upnp协议 映射本地端口到外网

    miniupnpc的主要函数介绍 1>.miniupnpc库主要使用的头文件有 #include"miniwget.h" #include"miniupnpc.h& ...

  2. Tether USDT 节点钱包的安装与使用-omni layer

    1 什么是Omni Layer Omni Layer是一种通信协议,它使用比特币区块链实现智能合约,用户货币和分散式点对点交换等功能. Omni Core是基于比特币核心代码库的快速,便携式Omni层 ...

  3. 为Ubuntu 安装Transmission 2.90

    Transmission 是 Ubuntu 的默认 BitTorrent 客户端,近期发布了最新的 Transmission 2.90 版本,目前已经可通过 PPA 为 Ubuntu 15.10.Ub ...

  4. Solidity 官方文档中文版 3_安装Solidity

    基于浏览器的Solidity 如果你只是想尝试一个使用Solidity的小合约,你不需要安装任何东西,只要访问 基于浏览器的Solidity http://remix.ethereum.org/. 如 ...

  5. Ubuntu上搭建比特币运行环境

    Ubuntu版本:16.04.3 Bitcoin Core版本:0.16 1. 比特币运行依赖的开源库 (1)必须依赖的库 库 目的 描述 libssl 加密 随机数生成,椭圆曲线加密算法 libbo ...

  6. Solidity 文档--第二章:安装 Solidity

    安装Solidity 基于浏览器的Solidity 如果你只是想尝试一个使用Solidity的小合约,你不需要安装任何东西,只要访问基于浏览器的Solidity. 如果你想离线使用,你可以保存页面到本 ...

  7. solidity代码

    http://www.tryblockchain.org/ 教你如何舒服的看solidity代码 最近智能合约随着区块链技术的发展越发收到广大技术人员的重视! 其中最被看好的以太坊就是一个提供智能合约 ...

  8. op应用:官方,wifidog,portal,uci,luci,脚本,框架,usb

    http://wiki.openwrt.org/doc/starthttp://downloads.openwrt.org/docs/buildroot-documentation.htmlhttp: ...

  9. Arch系统软件列表

    1. 安装统计 2. 安装列表 3. 安装说明 4. 作为依赖项的安装列表 5. 更正 mangaro使用减的方式安装系统.开箱即用的豪华版本,大部分人需要的都有了,同样包括个别用户不需要的,配置方面 ...

随机推荐

  1. 【JavaScript代码实现三】JS对象的深度克隆

    function clone(Obj) { var buf; if (Obj instanceof Array) { buf = []; // 创建一个空的数组 var i = Obj.length; ...

  2. 读书笔记_Effective_C++_条款三十七:绝不重新定义继承而来的缺省参数值

    先看下面的例子: enum MyColor { RED, GREEN, BLUE, }; class Shape { public: ; }; class Rectangle: public Shap ...

  3. X-010 FriendlyARM tiny4412 uboot移植之移植网卡驱动TFTP用起来

    <<<<<<<<<<<<<<<<<<<<<<<<< ...

  4. InvalidateRect(转)

    ///===================该段是自己总结的一个小结================================= InvalidateRect()函数的作用是设置一个无效区域,并 ...

  5. Clever Little Box 电缆组件 USB A 插座 至 USB B 插头

    http://china.rs-online.com/web/p/usb-cable-assemblies/7244156/ 产品详细信息 USB3.0适配器 superspeed USB将提供10x ...

  6. SCSI Pass-Through Interface Tool

    http://code.msdn.microsoft.com/SCSI-Pass-Through-a906ceef/sourcecode?fileId=59048&pathId=1919073 ...

  7. java基础学习总结——面向对象2

    一.JAVA类的定义

  8. Android中关于项目中对Thread的管理(不是线程池)

    背景 项目中对于一些并不复杂的耗时操作,比如计算,不频繁操作数据库等,因为没必要使用线程池,所以之前项目会直接使用new Thread的方式,时间一长,回头再看,原来new Thread之处已经很多了 ...

  9. Selenium2+python自动化46-js解决click失效问题

    前言 有时候元素明明已经找到了,运行也没报错,点击后页面没任何反应.这种问题遇到了,是比较头疼的,因为没任何报错,只是click事件失效了. 本篇用2种方法解决这种诡异的点击事件失效问题 一.遇到的问 ...

  10. UITableView的headerView展开缩放动画

    UITableView的headerView展开缩放动画 效果 源码 https://github.com/YouXianMing/Animations // // HeaderViewTapAnim ...