hi,
i am working on FRDMk64f120 controller. i modified Ethernet to serial project.
here,
" count = recv(task_p->sock_1, buff, RX_BUFFER_SIZE, 0);" so this function was waiting up to data receiving from server side. i don't
want this one. how to check server side data is there or not. if not i don't want to wait.i need NON-BLOCKING function. can you give some idea.
Regards,
sudhakar.p
Solved! Go to Solution.
Hi Sudhakar,
To disable the blocking in a recv() function it has to do with the sockets and not with the recv(). When the function returns depends on the values of the Receive Timeout socket options: OPT_RECEIVE_TIMEOUT. The application can change the values by calling setsockopt(). If the value is zero then RTCS waits indefinitely for incoming data during a call to recv(). If it is different than zero then RTCS waits for this number of milliseconds for incoming data during a call to recv(). The default is zero.
Try changing this value to 1 millisecond.
Have a great day,
Garabo
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Sudhakar,
To disable the blocking in a recv() function it has to do with the sockets and not with the recv(). When the function returns depends on the values of the Receive Timeout socket options: OPT_RECEIVE_TIMEOUT. The application can change the values by calling setsockopt(). If the value is zero then RTCS waits indefinitely for incoming data during a call to recv(). If it is different than zero then RTCS waits for this number of milliseconds for incoming data during a call to recv(). The default is zero.
Try changing this value to 1 millisecond.
Have a great day,
Garabo
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Garabo,
thanks a lot. i have one more problem in serial side also. in Ethernet to serial example project " tx_task" also waiting for data from serial. here also i need non blocking method , how to do that one.? if any function there to check data available on serial buffer or not. if available condition only i want to receive data.
count = fread(buff, 1, 1, ser_device);
so this one waiting for 1 data from serial side.
regards,
sudhakar.p
Hi Sudhakar,
I am afraid that the IO Subsystems configured to work with interrupt mode. You will need to use the the UART Peripheral driver rather than the IO Subsystem. The non-blocking function are UART_DRV_SendData() and UART_DRV_ReceiveData(). For more information about these functions can be found in the document ..\KSDK_1.1.0\doc\Kinetis SDK v.1.1 API Reference Manual.pdf
Hope this solves your question.
Have a great day,
Garabo
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Sudhakar,
Could you please let us know what MQX version you are using?
Regards,
Garabo
i am using KSDK 1.1.0 version. and also KDS 2.0.0 IDE am using