title: Android port forwarding
body: <p>How can I make a port forwarding from a android device to router using the IP from another device?</p>
  
  <p>I want to connect from android device externally to a routers public ip:port so that I can access the hardware device that is connected to the router.(Android -> external IP:Port) -> Router -> hardware Device(hardware device has its own IP and mac).</p>
  
  <p><img src="https://i.stack.imgur.com/7RMcj.jpg" alt="enter image description here"></p>
  
  <p>Code:</p>
  
  <pre><code>    PortMapping mapping = new PortMapping();
      UnsignedIntegerTwoBytes externalPort = new UnsignedIntegerTwoBytes(22555L);
      UnsignedIntegerTwoBytes internalPort = new UnsignedIntegerTwoBytes(80L);
  
      mapping.setDescription("HardwareDescription");
      mapping.setEnabled(true);
      mapping.setExternalPort(externalPort);
      mapping.setInternalClient("192.168.2.68");
      mapping.setInternalPort(internalPort);
      mapping.setProtocol(PortMapping.Protocol.TCP);
      mapping.setRemoteHost("192.168.2.254");
  
  
      mUpnpService = new MyUpnpServiceImpl(new PortMappingListener(mapping));
      mUpnpService.getRouter();
      mUpnpService.getControlPoint().search(SCAN_TIMEOUT);
  </code></pre>
  
  <p>UpnpServiceImpl:</p>
  
  <pre><code>private class MyUpnpServiceImpl extends UpnpServiceImpl {
  
      public MyUpnpServiceImpl(RegistryListener... listeners) {
          super(new AndroidUpnpServiceConfiguration(getWifiManager()),
                  listeners);
      }
  
      @Override
      public Router getRouter() {
          return super.getRouter();
      }
      @Override
      protected Router createRouter(ProtocolFactory protocolFactory,
              Registry registry) {
          return new AndroidWifiSwitchableRouter(configuration,
                  protocolFactory, getWifiManager(), getConnectivityManager());
      }
  }
  </code></pre>
  
  <p>The code above doesn't crash, but also it doesn't create any port!</p>
  
  <p>Is this possible? 
  If the answer is yes, can you point me in the right direction.</p>