How are sockets and netifs connected in ESP32?
How are sockets and netifs connected in ESP32?
I'm developing an app that uses the ESP-MESH network interfaces. For that I would like to know how to write TCP-packets to that netif. I read this very helpful blogpost , but I'm pretty sure that the architecture within the esp is somewhat different than in Linux.The basic implementation of HTTP writes to a socket, but then how does that socket know what network interface to use?
- Vader_Mester
- Posts: 300
- Joined: Tue Dec 05, 2017 8:28 pm
- Location: Hungary
- Contact:
Re: How are sockets and netifs connected in ESP32?
I suggest you read this, will be helpful.
https://docs.espressif.com/projects/esp ... netif.html
By the way, when you initilaize the Wifi with MESH, there is a function that initializes the netif as well.
https://docs.espressif.com/projects/esp ... netif.html
By the way, when you initilaize the Wifi with MESH, there is a function that initializes the netif as well.
Code: Select all
task_t coffeeTask()
{
while(atWork){
if(!xStreamBufferIsEmpty(mug)){
coffeeDrink(mug);
} else {
xTaskCreate(sBrew, "brew", 9000, &mug, 1, NULL);
xSemaphoreTake(sCoffeeRdy, portMAX_DELAY);
}
}
vTaskDelete(NULL);
}
Re: How are sockets and netifs connected in ESP32?
Thank you! I have though already read the documentation on netifs, meshes and a lot of other stuff but I still can't wrap my head around this particular thing.
So what happens when I create a netif and the tcp module writes to a socket? Through which netif will the data leave the esp when I have multiple of them? I think I'm missing a piece here..
So what happens when I create a netif and the tcp module writes to a socket? Through which netif will the data leave the esp when I have multiple of them? I think I'm missing a piece here..
Re: How are sockets and netifs connected in ESP32?
@WiFive That's the example I'm studying right now. As far as I can see, the root node will handle the IP traffic of the network. All nodes receive from mesh with esp_mesh_recv() and pass it on to the interfaces with esp_netif_receive(), isn't it? But then how does the kernel know which socket it has to pass on the data?
My current understanding is this:
(or vice versa) Is this correct?
My current understanding is this:
Code: Select all
Socket (application API) --> kernel --> netif --> mesh
Re: How are sockets and netifs connected in ESP32?
It is based on lwip forwarding using netmasks and the default netif
Re: How are sockets and netifs connected in ESP32?
Thank you can you recommend to me some literature or a place to start reading? I would like to know more about this topic!
Who is online
Users browsing this forum: No registered users and 98 guests