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
可以在谷歌上这样搜索关键字: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
原文:http://www.cnblogs.com/jingzhishen/p/3572215.html