- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have an application that will receive infrequent commands over at TCP connection. I was wondering if there was a way to have a thread that handles the packet wake up at a packet reception event? The only packets it will receive will be commands, so the thread could wake up at any packet, not just TCP.
Follow up - is there an API to allow for explicit wakeup/send to sleep of a created thread?
Thanks!
Solved! Go to Solution.
- Labels:
-
TCPIP
-
WICED Studio
-
Wireless MCU
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Use asynchronous callbacks instead of busy loop to receive data.
You can reference tcp_server_async snip code as reference.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hello:
< have a thread that handles the packet wake up at a packet reception event. >
for this line: Do you mean: 1. our board is in sleep mode.
2. keep the connection, will receive TCP packet from other client .
3. a packet reception event will wake up the board, then deal with all the packets?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi ZhengbaoZ_96, thanks for the reply and follow up question.
The answer is option 2: the board will be awake and functioning - it will have other threads running and doing tasks. I just want to send the thread responsible for the TCP receive to sleep and have it be woken up by the (VERY infrequent) command packets.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Use asynchronous callbacks instead of busy loop to receive data.
You can reference tcp_server_async snip code as reference.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content