JMule project forum
http://forum.jmule.org/

How Jmule work with NAT and uPnP?
http://forum.jmule.org/viewtopic.php?f=7&t=703
Page 1 of 1

Author:  artiya4u [ Sat Jun 26, 2010 7:39 am ]
Post subject:  How Jmule work with NAT and uPnP?

How Jmule work with NAT and uPnP?
i'm try to do this with http://www.sbbi.net/site/upnp/index.html. What shall i do next?

Author:  javajox [ Sun Jun 27, 2010 9:54 am ]
Post subject:  Re: How Jmule work with NAT and uPnP?

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();
         }
 

Author:  artiya4u [ Wed Jun 30, 2010 8:52 am ]
Post subject:  Re: How Jmule work with NAT and uPnP?

Thx I think it's a good idea for Jmule.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/