1

シンプルな API を備えたライブラリが必要です。シンプルな定義: 私にとって完璧なソリューションは、ここで説明されているようなものですが、Java でクロスプラットフォームで使用するために追加されています (私にとってのクロスプラットフォームは、Win、Mac、Lin 用のスタンドアロンのデスクトップ アプリです)...では、API はどのように見えますか? 私が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();
}

私はそれで何をする予定ですか?私は、Google App Engine の無料プランの分散型 (クラウドのような) ファイル サーバーを使いやすく作成したいと考えています。これは、一般に、私のアプリ ユーザーのコンピューターに基づいています...つまり、彼らが私のアプリを使用していると言うと、彼らはそれをホストしています =)

4

2 に答える 2

1

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.

于 2010-10-11T13:23:25.973 に答える
1

「Punching Holes with Java RMI 」をご覧になることをお勧めします。参考になるかもしれません。

于 2010-10-11T13:23:57.157 に答える