Indradhanush Gupta
Indradhanush Gupta

Reputation: 4237

Different ports for listening and reading

Should I use different ports for listening and reading in a peer to peer application? If so, why not a single port for both listening and reading?

Upvotes: 0

Views: 2125

Answers (1)

user207421
user207421

Reputation: 311023

If you're talking about TCP, you don't get the choice: accepted sockets use the same local port as the listening port (and outbound ports have to use a different port, if you need them). If you're talking about UDP, there's no reason to use more than one socket, so no occasion to use more than one port. So the answer in both cases is the same: use one port.

Upvotes: 2

Related Questions