We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
Im using RTX kernel with the TCP Net library. The manual says I have to do all my Tcpnet jobs in one task ...
So , I have to manage some events for each Tcp socket used. (connecting, sending data , deconnecting) . I want to use the os_evt_wait_or() function with switch/case but the tcpnet requires a polling of main_tcp()
So is it possible to use os_evt_get() in order to avoid to much latency for the main_tcpnet to be called, like this ?
void tcp_task(void) __task { ... while(1) { main_TcpNet(); switch (os_evt_get()) { case ... case ... } } }
Or I have to use os_evt_wait_or() like this :
void tcp_task(void) __task { ... while(1) { main_TcpNet(); os_evt_wait_or(mask,100ms) switch (os_evt_get()) { case ... case ... } } }
Thanks in advance
os_evt_get() returns the list of events that caused the os_evt_wait_or to return with OS_R_EVT. If you do not call os_evt_wait_or(), os_evt_get() will not ever return any events. You may do an os_evt_wait_or(mask,0ms) with a zero time out, if it returns OS_R_EVT that means there was at least 1 event and you can do the os_evt_get() to retrieve them. (note that there may be more than one event set so that the switch directly on this value might not be the best choice)