UDP Multicast with Julia

question

#1

Hello,

I am using the following function to read UDP messages with Julia:

# background loop for receiving UDP messages, terminated with <ctrl> + <c>
function receiveData(server_ip)
	global terminate
	udpsock = UDPSocket()
	bind(udpsock, server_ip, port)
	i = 0
	try
		while true
			msg = String(copy(recv(udpsock)))
			enqueue!(q, msg)
		end
	catch my_exception
		if isa(my_exception, InterruptException)
			close(udpsock)
			terminate[1] = true
		end
	end
end

Now I want to receive multicast messages on the address 239.0.0.1. In C# this can be done by calling the method “JoinMulitcastGroup(adress)”. How can this be done in Julia?


#2

I tried to use the function setopt as documented here:
http://docs.julialang.org/en/stable/stdlib/io-network/

but I am getting the error message:
ERROR: UndefVarError: setopt not defined

Is there a possibility to call a C function of the Linux standard library directly
to subscribe to a broadcast group?


#3

Here is a nice example how to do it in C, maybe it is just stuffing the struct with correct values:


In fact it is an offtopic reply -> multicast.

I should work on broadcast and multicast in the near future so please report your findings :slight_smile:.


#4

Thanks for your hint!
But this still seams to be unresolved. I created an issue:

Uwe