Spaced
Spaced

Reputation: 55

Can there ever be more than one program running on a single port?

Can there ever be more than one program running on a single port? In other words, can two applications on the same server have the same port number?

Upvotes: 1

Views: 96

Answers (2)

Zoey Mertes
Zoey Mertes

Reputation: 3144

If they're bound to different IPs, yes. Binding to a port binds to both a IP address and a port number. So if application A is bound to 192.168.0.56:25565, and application B is bound to 127.0.0.1:25565 they'll be no issue. But if application C wants to bind to either of those, or bind to 0.0.0.0:25565, it'll be given a error.

Upvotes: 3

NPE
NPE

Reputation: 500167

For TCP: Yes, as long as they are bound to different interfaces (e.g. eth0 and loopback). On the same interface, no.

For UDP: Yes.

Upvotes: 2

Related Questions