Rella
Rella

Reputation: 66945

Example of simple port forwarding using any UPnP library in Java?

I want to open port 5555 on my machine using UPnP to the world. Could you please provide me with such Java sample for any sutable Opensource library. I need A CODE SAMPLE like one I can give you for C# using this lib

using TCMPortMapper;

private void Form1_Load()
{
  PortMapper.SharedInstance.Start();
  PortMapping pm = new PortMapping(localPort, publicPort, 
         PortMappingTransportProtocol.TCP);
  PortMapper.SharedInstance.AddPortMapping(pm);
}
private void Form1_FormClosing()
{
  PortMapper.SharedInstance.StopBlocking();
}

Upvotes: 1

Views: 3929

Answers (1)

Hasturkun
Hasturkun

Reputation: 36402

Have you tried googling for "java upnp library"?

My first hit was one UPNPLib that looks reasonable. sample for UPNP mapping with same. there are also others:

Upvotes: 1

Related Questions