I understand that I can bind to INADDR_ANY with 1 port and then join multiple multicast groups.
However, it seems like it is not possible to bind to INADDR_ANY and then join multiple multicast groups with different ports because it seems like the port has to be specified during binding but a socket can only bind once.
Is there a way to get around it so that I can have 1 socket to listen to multiple multicast groups with different ports?
Thanks in advance.
However, it seems like it is not possible to bind to INADDR_ANY
Wrong.
and then join multiple multicast groups with different ports
Correct.
because it seems like the port has to be specified during binding but a socket can only bind once.
Correct.
Is there a way to get around it so that I can have 1 socket to listen to multiple multicast groups with different ports?
No.