views:

41

answers:

2

I need a library with simple API. Defining simple: perfect solution for me would be something like described here but addopted for crossplatform use in Java (crossplatform for me is stand alone desctop app for Win, Mac, Lin)... So how API I would like to see looks like? Like oneI have in C#:

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

What I plan to do with it? I want to create easy in use with Google App Engine free plan distributed (cloud like) file server that would be generaly based on my app users computers... so to say they use my app they houst it=)

+1  A: 

I looked around and the most promising library I found was miniupnp. The official specs on how to do this are called UPnP IGD, and it's painfully complicated and nasty to read.

It should be possible to do this from Java, you need network capabilities, and sufficient privileges to send and receive UDP packets on special ports. I made a Python porting attempt that worked on my LAN, you might port that (it's a simplification of miniupnp). If you haven't taken the time to learn Python, I highly recommend it.

Matt Joiner
The mini daemon does not work on Windows.
Amigable Clark Kant
Try compiling it with cygwin, or port it to use Winsock (this is trivial to do). The rest should be fine.
Matt Joiner
+1  A: 

I recommend you have a look at "Punching Holes with Java RMI, it might be helpful.

Amigable Clark Kant