Other Parts Discussed in Thread: CC3200
I'm using cc3200 .When i creat a client and link to a server ,i use sl_recv call recive data .But it is blocked in it.I want to know how to use a none blocking call.
thanks
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Other Parts Discussed in Thread: CC3200
I'm using cc3200 .When i creat a client and link to a server ,i use sl_recv call recive data .But it is blocked in it.I want to know how to use a none blocking call.
thanks
Hi Li,
You can use following code snippet to make socket as non_blocking
SlSockNonblocking_t enableOption; enableOption.NonblockingEnabled = 1; // Enable/disable nonblocking mode sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_NONBLOCKING, (_u8 *)&enableOption,sizeof(enableOption));
Regards,
Jitendra
Hi,
If this sets the Socket to non-Blocking mode, how can I know when data is ready to be read on the socket?
To then call sl_Recv(), for example.
Thanks, Tom
Hey, guys!
Any updates on this? Is there any way to know if there is data available in the socket?
Appreciate your help!
Thanks and cheers,
Hi.
You should simply use the return value from the recv function
int iSize = sl_recv......
if it is positive, you've got iSize bytes awaiting in the buffer.
if it's EL_AGAIN - you've got to try again to read,
else - you've got an error.