I'm doing a small demo project of a DHT (p2p routing only, like Chord, Pastry, etc.), and I'm confused about the detail of transportation in a P2P network.
Assuming all peers communicate using UDP and the port is 10050, which is a fixed one, then consider two typical cases:
- A may send a "JOIN" message to B.
- Also, B may send a "JOIN" message (or other messages) to A according to the p2p nature.
In case 1, the destination port of the message must be 10050;
In case 2, the destination port of the message must be 10050;
I wonder what's the source port of the messages in both cases? If it's a random port decided by system calls, the DHT protocol stack need to process datagram on 10050 and the random port, is this the normal behavior in DHT based application (e.g., emule, bittorrent)?