How can I receive a Thread UDP packet from a network socket without using the Session module?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How can I receive a Thread UDP packet from a network socket without using the Session module?

1,912件の閲覧回数
thomasblank
Contributor II

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.

タグ(2)
0 件の賞賛
返信
1 返信

1,629件の閲覧回数
estephania_mart
NXP TechSupport
NXP TechSupport

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

Reboot will be caused immediately as soon as it received Socket Bind command for the TCP protocol + ...

Best Regards, 

Estephania 

0 件の賞賛
返信