Unicast / Multicast as Unicast

Warpstar22
Posts: 2
Joined: Thu Jul 26, 2018 6:47 pm

Unicast / Multicast as Unicast

Postby Warpstar22 » Wed Sep 12, 2018 6:45 pm

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

ESP_Sprite
Posts: 9014
Joined: Thu Nov 26, 2015 4:08 am

Re: Unicast / Multicast as Unicast

Postby ESP_Sprite » Thu Sep 13, 2018 2:34 am

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.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Unicast / Multicast as Unicast

Postby WiFive » Thu Sep 13, 2018 3:16 am

He is right that lwip and bsd sockets features are not really part of the docs.

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

ESP_Sprite
Posts: 9014
Joined: Thu Nov 26, 2015 4:08 am

Re: Unicast / Multicast as Unicast

Postby ESP_Sprite » Thu Sep 13, 2018 4:20 am

Hmm, that is a valid point. Perhaps we should add at least a hint to this to the docs.

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: Unicast / Multicast as Unicast

Postby fly135 » Thu Sep 13, 2018 3:39 pm

I've used unicast with the socket api. It works.

John A

Warpstar22
Posts: 2
Joined: Thu Jul 26, 2018 6:47 pm

Re: Unicast / Multicast as Unicast

Postby Warpstar22 » Thu Sep 13, 2018 10:02 pm

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?

ESP_Sprite
Posts: 9014
Joined: Thu Nov 26, 2015 4:08 am

Re: Unicast / Multicast as Unicast

Postby ESP_Sprite » Fri Sep 14, 2018 1:53 am

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.

Who is online

Users browsing this forum: Bing [Bot], martins and 125 guests