-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zmq_udp: need ability to specify bind address separately from multicast address for multi-homed hosts #2212
Comments
Looks like a good idea, just a note: TCP sockets already support passing an address to bind to with the format: This sounds similar, right? What about using the same format for consistency? |
I was not aware of that syntax. Consistency makes perfect sense. I think ultimately the code in |
I started refactoring code to move shared logic of address parsing and representation into a base |
Oh, looks like we had the same idea one year apart. The factored parsing code got merged in #3070 and #3075 ports the UDP API to the shared code. Once it's merged adding bind address specification is going to be trivial. I agree that the semicolon syntax makes the most sense, especially since that's what PGM does: zmq_connect(socket, "pgm://192.168.1.1;239.192.1.1:5555"); I was wondering however if we should make it mandatory for multicast binding (a breaking change, but not critical since it's DRAFT) or have socket_a.bind("udp://223.0.0.1:5555");
socket_b.bind("udp://224.0.0.1:5555"); These two calls look similar but the first one binds the local interface "223.0.0.1" on port 5555 while the second binds INADDR_ANY on port 5555 while subscribing to the multicast network 224.0.0.1. I think this overloaded syntax is a bit awkward. Meanwhile this should be clear: socket_a.bind("udp://223.0.0.1:5555");
socket_b.bind("udp://*;224.0.0.1:5555"); |
I would suggest to do the same as the other multicast transport do w.r.t. default binding, so that there are the least surprises |
Agreed, I need to figure out what PGM does. |
So, regarding pgm:
I guess the current "implicit multicast" format should be kept then, although as a counterpoint I could say that PGM so there's no really room for confusion, UDP has no such limitation. |
Let's keep them in sync for now - it's still in draft stage so we can eventually change if there are complaints |
…dress for multicast Solution: augment the UDP URL syntax to accept an interface specifier with a syntax similar to the PGM urls. Fixes zeromq#2212
…dress for multicast Solution: augment the UDP URL syntax to accept an interface specifier with a syntax similar to the PGM urls. Fixes zeromq#2212
…dress for multicast Solution: augment the UDP URL syntax to accept an interface specifier with a syntax similar to the PGM urls. Fixes zeromq#2212
The
ZMP_RADIO
andZMP_DISH
socket types look like great addition to ZMQ. Thanks!When receiving multicast data on multi-homed hosts, some users will require the ability to select which interface is used for a given multicast stream, as the data may not transit on the default interface.
I'd suggest a syntax perhaps like
udp://mcaddr[@bindaddr]:port
(where[]
indicates the@bindaddr
is optional not that it appears in square brackets)So, in other words, this code on lines 114-116 from
udp_socket.cpp
would need to change:Also, I believe all of these
htons
should behtonl
(all from udp_socket.cpp):When configuring many hosts it is also useful to be able to specify the bind address by its interface name or using address/mask (i.e. 192.168.2.0/24). These would require the use of additional OS-specific APIs (i.e.
getifaddrs(3)
), but this is very powerful and will make configuration much more manageable.The text was updated successfully, but these errors were encountered: