Example of simple port forwarding using any UPnP library in Java?
-
08-10-2019 - |
Question
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();
}
Solution
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:
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow