English 中文(简体)
使用套接字插件的 P2P 应用程序
原标题:P2P application using sockets

我有两个 P2P 应用程序在运行, 一个在 10.7.1.1 (A) 中, 另一个在 10.7.1.3 (B) 中。 它是一种聊天应用程序, 每个人在其中只发送和接收短信, 没有其他东西。 基本上我与 A 和 B 中的两个 UDP 插座接口, 用于监听和发送文本。 目前我对两个系统中的端口号进行了硬编码, 以建立套座。 现在, 我如何改进同样的应用程序, 动态地查找端口号以建立套座? 换句话说, 我希望应用程序只接受用户的IP 地址, 然后自己建立一个连接插座的端口? 这个设计可以实现吗? 这样做的方法是什么?

问题回答

您可以将您的端口注册为一些尚未描述的服务, 这样二审就可以确定您一审的端口正在监听的端口 。

或者你可以开始在硬码端口监听, 然后作为初始握手的一部分, 切换到动态生成的端口 。





相关问题
Maintaining network integrity in peer-to-peer network

I am looking for information on techniques, algorithms, etc. on how to maintain network integrity in a dynamic peer-to-peer network. Both practical implementations, academic papers and anything else ...

Open-source p2p videoconferencing in Flash or Java?

I want to build a community website with videoconferencing functionality integrated. I would prefer to provide this from within the browser, so I m looking for a Java- or Flash-based solution. Also, ...

JXTA Applications on the iPhone

I m creating a P2P Java application in JXTA, for simple messaging between peers. I want to create a similar program on the iPhone, that will be able to talk with this java JXTA program. Is this ...

NAT, P2P and Multiplayer

How can an application be designed such that two peers can communicate directly with each other (assuming both know each other s IPs), but without outgoing connections? That s, no ports will be opened....

The most efficient DHT

What is the most efficient DHT? I am looking for name and/or some kind of implementation or related work, but I am not looking for the one that is most used. Efficient in terms of CPU execution ...

P2P or Distributed System implementation

I have the work of implementing a distributed system of nodes (like p2p nodes) each of these nodes (lets say A,B,C and D) perform certain functions and need to interact with each other for various ...

热门标签