I am using the MCUXPresso SDK version 2.2 with the Thread stack on the KW41Z.
The manual says that in order to receive a packet on a UDP socket, I must register a Session callback, initilialize the Session task, a message queue, etc. I want to use just the simple recv() function.
When I try that, it does not seem to work. Also I can not see how I could give the function a timeout, or tell it to block until a packet comes in, or use a function like select() to find out when a packet arrives. It just immediately returns and gives me an error (-1).
Please explain how I should use the recv() function to receive UDP packets on a socket.
Hello,
When you are trying to send a message you will need to create the socket, bind it and create a connection.
If you are trying to receive from a socket you will need to create a socket, bind the IP with a port and it will be listed, this is enabled by the #define SOCK_DEMO.
If you want to see step by step the how to use UDP sockets on a Thread Host Controlled Device using SDK from MCUXpresso you can check the following thread
Best Regards,
Estephania