Avb Avb
Avb Avb

Reputation: 553

Port and IP address usage in UDP communication

I have two clients and I want to connect them to daemon which is using UDP socket. It is using IP addr1 and Port#1 for communication. In each client, I create a socket with the same IP and port#1 that daemon is using. Is that okay to use same IP address and port# for both clients?

Upvotes: 1

Views: 177

Answers (1)

Marcus
Marcus

Reputation: 297

That depends on what you mean by "use."

It is correct for both clients to do connect() or sendto() using the IP and port the daemon is listening on.

It would not be ok for any of the clients to do bind() using the IP and port the daemon is listening on.

Upvotes: 3

Related Questions