分类: LINUX
2011-05-10 12:03:46
You should first list (-l) the services, actions and arguments supported by your IGD device.
Then you can invoke any command following the syntax:
./upnpc -a device:service:action arg1,arg2,arg3
One example would be:
./upnpc -a 0:3:2 80,TCP,1922.168.0.1,80
The actual parameters and values will depend on the device. Using -l you will have a list of the parameters you can use.
I will keep updating this code as i find necessary. Still, as my problem is solved, this code may stall until i require some additional feature, or someone submits a patch.
Any question regarding miniupnp, please contact Thomas Bernard at a:
3../upnpc-shared
upnpc : miniupnpc library test client. (c) 2006-2009 Thomas Bernard
Go to or
for more information.
Usage : ./upnpc-shared [options] -a ip port external_port protocol
Add port redirection
./upnpc-shared [options] -d external_port protocol [port2 protocol2]Â*[...]
Delete port redirection
./upnpc-shared [options] -s
Get Connection status
./upnpc-shared [options] -l
List redirections
./upnpc-shared [options] -r port1 protocol1 [port2 protocol2] [...]
Add all redirections to the current host
It looks like the "-a" option will do exactly what you want. It will automagically discover your router IP if the router is UPnP compatible.