Java 中的网络/在线应用程序

发布于 2024-08-09 07:46:18 字数 137 浏览 5 评论 0原文

使用 J2SE,我尝试使用 java.net.* 制作一个 LAN 应用程序,并且它运行得很好。我相信这与在线应用程序的概念非常相似(如果不是相同)。

我应该使用什么包或类来开发在线应用程序?我需要静态 IP 地址吗?欢迎提出意见、链接和教程。

Using J2SE, I tried making a LAN application using java.net.*, and it worked perfectly. I believe it's very similar (if not the same) concept to be applied for online applications.

What package(s) or classes should I use to develop an online application? do I need a static IP address? Opinions, links and tutorials are welcomed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

铃予 2024-08-16 07:46:18

基本上,在 Internet 上运行的应用程序与在 LAN 上运行的应用程序完全相同。有几点需要记住:

  • 找到连接的另一方可能会更困难。您实际上无法进行任何广播,因此您可能需要一些中央代理服务器来帮助不同的客户端找到彼此。
  • 网络性能通常要弱得多。这意味着带宽和往返时间。虽然在 LAN 上 1-2 毫秒的 ping 很容易实现,但在互联网上您会得到更差的值。不同的应用程序在这里有不同的要求,因此有些应用程序可能不关心往返时间,而对于其他应用程序来说,带宽不是问题
  • 有些计算机可能根本没有公共 IP 地址,例如,如果它们是 NAT 。这意味着其他人无法连​​接到他们。通常,只要它们是发起连接的人,它们就可以很好地连接到公共 IP 地址(有一些黑客可以帮助通过 UDP“连接”两台非公共计算机,但它们很难做到)。

Basically an application that works on the internet works exactly the same as one that works on a LAN. There are just a few points to keep in mind:

  • Finding the other party of a connection might be harder. You can't really do any broadcasts, so you might need to have some central broker server to help different clients find each other
  • Network performance is usually a lot weaker. This means both bandwidth and round-trip time. While on a LAN a ping of 1-2 ms is very easy to achieve, you'll get much worse values on the internet. Different applications have different requirements here, so some might not care about the round-trip times, while for others the bandwidth is not an issue
  • Some computers might not have a public IP address at all, for example if they are NATed. This means that others can't connect to them. Usually they can connect to public IP addresses just fine, as long as they are the one initiating the connection (there are hacks that can help "connect" two non-public computers via UDP, but they are hard to do).
把昨日还给我 2024-08-16 07:46:18
 it's very similar (if not the same) concept to be applied for online applications.

如果在线应用条件差异很大,则必须绕过对等双方的 NAT 和防火墙。

我建议您浏览 JXTA

 it's very similar (if not the same) concept to be applied for online applications.

In case of online applications conditions are lot much different, you have to bypass NAT and Firewall on both sides of peer.

I recommend you to go through JXTA.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文