是否有可能让两台计算机在没有 Java 中涉及的任何服务器的情况下通过套接字相互连接?如果是这样,怎么做?我只看到了服务器是永久的服务器-客户端连接的例子。
例如:
1. 2 people, person A and person B, want to connect using this application
2. Person A runs application, clicks "host"
3. Application hands person A a code (IP+port?) and begins listening.
4. Person B clicks "join" and types in code.
5. Person B's computer sees Person A's computer and they connect. Person A accepts connection.
我从来没有真正理解这一点。如果这是一个不好的问题,请原谅我。