Page 1 of 1

Unicast / Multicast as Unicast

Posted: Wed Sep 12, 2018 6:45 pm
by Warpstar22
Hi,

Looking at the idf docs, it doesn't seem that udp unicast is an available API for the ESP32 boards. Is this true? And why? This seems like an odd thing to not have as it is a standard protocol used everywhere.

If so, how would I use multicast in place of it. As I understand it, there is a different ip address form it uses. I get a warning that my ip address is not a valid multicast address. I'm using the example code available in idf.
I'm using c on a raspberry pi for the server implementation. How do I configure this as well to use multicast as unicast?

Thanks

Re: Unicast / Multicast as Unicast

Posted: Thu Sep 13, 2018 2:34 am
by ESP_Sprite
You don't specify a protocol, I assume you mean USP uni/multicast? If so, ESP-IDF implements the largest part of the BSD socket specification, and unicast works perfectly through that. Just throw 'C UDP server example' into Google and chances are very high that the code you find works on the ESP32 without change.

Re: Unicast / Multicast as Unicast

Posted: Thu Sep 13, 2018 3:16 am
by WiFive
He is right that lwip and bsd sockets features are not really part of the docs.

https://github.com/search?q=esp32+udp

Re: Unicast / Multicast as Unicast

Posted: Thu Sep 13, 2018 4:20 am
by ESP_Sprite
Hmm, that is a valid point. Perhaps we should add at least a hint to this to the docs.

Re: Unicast / Multicast as Unicast

Posted: Thu Sep 13, 2018 3:39 pm
by fly135
I've used unicast with the socket api. It works.

John A

Re: Unicast / Multicast as Unicast

Posted: Thu Sep 13, 2018 10:02 pm
by Warpstar22
That's so odd. I figured multicast would work fine but I ran into an issue as I mentioned where I got a warning that the IP address was not a valid multicast address. I know the server implementation is fine because I was using it for another board.
I'm using the multicast example code and just changed the example configuration in the menuconfig. Was there something else in the code I should have changed too?

Re: Unicast / Multicast as Unicast

Posted: Fri Sep 14, 2018 1:53 am
by ESP_Sprite
Probably. Setting up a multicast socket needs some specific calls to the network stack to be done to make sure the network switching fabric routes those multicast packets correctly. If you feed those calls a non-multicast address, they'll complain.