Skip to content
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

Please add a function to join an UDP multicast group #21300

Closed
ufechner7 opened this issue Apr 6, 2017 · 3 comments · Fixed by #35521
Closed

Please add a function to join an UDP multicast group #21300

ufechner7 opened this issue Apr 6, 2017 · 3 comments · Fixed by #35521
Labels
help wanted Indicates that a maintainer wants help on an issue or pull request io Involving the I/O subsystem: libuv, read, write, etc.

Comments

@ufechner7
Copy link

Joining a UDP multicast group is not yet supported by Julia.
Probably it requires just one operation system specific function call to set the correct options.
We really need this!
Uwe

@JeffBezanson JeffBezanson added the io Involving the I/O subsystem: libuv, read, write, etc. label Apr 6, 2017
@Paul-at-home
Copy link

Paul-at-home commented Jul 29, 2019

This worked for me.

Create the socket:
s = UDPSocket()

Bind:

bind(s, ip"multicast IP", port_no)

Join the multicast group:
ccall(:uv_udp_set_membership, Cint, (Ptr{Cvoid}, Ptr{UInt8}, Ptr{UInt8}, Cint), s.handle, "multicast IP", C_NULL, 1)

Get a message:
msg = recv(s)

Leave the multicast group:

ccall(:uv_udp_set_membership, Cint, (Ptr{Void}, Ptr{UInt8}, Ptr{UInt8}, Cint), s.handle, "multicast IP", C_NULL, 0)

@StefanKarpinski
Copy link
Member

If someone wants to take these C calls and turn them into an API we'd be happy to have them.

@StefanKarpinski StefanKarpinski added the help wanted Indicates that a maintainer wants help on an issue or pull request label Jul 29, 2019
@Paul-at-home
Copy link

Paul-at-home commented Jul 30, 2019

Sorry - I don't feel qualified to put it into the API!

I would add that in this call:
ccall(:uv_udp_set_membership, Cint, (Ptr{Void}, Ptr{UInt8}, Ptr{UInt8}, Cint), s.handle, "multicast IP", C_NULL, 0)

C_NULL refers to the interface from ifconfig command line. C_NULL takes default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Indicates that a maintainer wants help on an issue or pull request io Involving the I/O subsystem: libuv, read, write, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants