JMule project forum

JMule - Java file sharing client
 

It is currently Mon Dec 11, 2017 2:08 am

Your Ad Here


Post new topic Reply to topic  [ 3 posts ] 
Author Message
Offline
 Post subject: How Jmule work with NAT and uPnP?
PostPosted: Sat Jun 26, 2010 7:39 am 
 Profile

Joined: Wed May 26, 2010 5:57 am
Posts: 7
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?


Top
 

Offline
 Post subject: Re: How Jmule work with NAT and uPnP?
PostPosted: Sun Jun 27, 2010 9:54 am 
JMule staff member
JMule staff member
 WWW  Profile

Joined: Fri Jul 11, 2008 4:34 pm
Posts: 43
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();
         }
 


Top
 

Offline
 Post subject: Re: How Jmule work with NAT and uPnP?
PostPosted: Wed Jun 30, 2010 8:52 am 
 Profile

Joined: Wed May 26, 2010 5:57 am
Posts: 7
Thx I think it's a good idea for Jmule.


Top
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Contact : jmule [at] jmule.org
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group