Hello,
I would like to use the netconn api in lwIP to use multicast.
There is the function "netconn_join_leave_group" which has the parameter "netif_addr" which is described as "the IP address of the network interface on which to send the imgp message".
Is there a macro I can use for this parameter?
As my ESP32 gets an IP via DHCP the IP might change.
So how can I make sure that always the correct IP is used?
Thank you very much.
lwIP netconn: netif_addr, what is the correct variable
Re: lwIP netconn: netif_addr, what is the correct variable
Thanks!
Sadly I could not get it to work.
Your example uses BSD sockets which I would like to avoid.
It would be really great if someone could help me to get it work.
Please see my example.
Thank you very much!
Sadly I could not get it to work.
Your example uses BSD sockets which I would like to avoid.
It would be really great if someone could help me to get it work.
Please see my example.
Thank you very much!
Code: Select all
static void udp_send_multicast(void *pvParameters) {
char tag[] = "udp_multicast_send_task";
ESP_LOGI(tag,"udp_multicast_send task started \n");
struct netconn *conn;
struct netbuf *buf;
char* data;
struct ip_addr_t multicastip; //Says size of multicastip is unknown
IP4_ADDR(&multicastip,239,255,255,250);
char msg [100];
sprintf(msg, "multicast test message");
conn = netconn_new(NETCONN_UDP);
netconn_bind(conn,IP_ADDR_ANY,4990);
netconn_join_leave_group(conn,multicastip,0,NETCONN_JOIN); //What do I have to use here as second and third argument?
while(1) {
buf = netbuf_new();
data = netbuf_alloc(buf, sizeof(msg));
memcpy(data,msg,sizeof(msg));
netconn_send(conn,buf);
netbuf_delete(buf);
vTaskDelay(10000 / portTICK_PERIOD_MS);
}
}
Who is online
Users browsing this forum: No registered users and 321 guests