Hello,
JMule does not support port mapping using UPNP yet
If you want to add such a feature to JMule using sbbi-upnp you should do something like that :
Code:
try {
JMuleCore _core = JMuleCoreFactory.getSingleton();
ConfigurationManager _config = _core.getConfigurationManager();
InternetGatewayDevice[] internet_gateways = InternetGatewayDevice.getDevices( 5000 );
if ( internet_gateways != null ) {
// suppose you found a single device
InternetGatewayDevice internet_gateway = internet_gateways[0];
// now let's open the port
// this should be taken from _config (the bounded JMule ip address, not realized yet in JMule)
String my_ip = InetAddress.getLocalHost().getHostAddress();
boolean mapped = internet_gateway.addPortMapping( "JMule port mapping",
null, _config.getTCP(), _config.getTCP(),
my_ip, 0, "TCP" );
if ( !mapped ) {
System.out.println("The port " + _config.getTCP() + " could not be mapped");
}
}
} catch ( IOException cause1 ) {
cause1.printStackTrace();
} catch( UPNPResponseException cause2 ) {
cause2.printStackTrace();
} catch( ConfigurationManagerException cause3 ) {
cause3.printStackTrace();
}