Hi,
Using CC3200 as TCP server, a socket is created to receive data from TCP client.
I see there is two options for creating this socket:
SL_SO_NONBLOCKING & SL_SO_RCVTIMEO
lNonBlocking = 1;
iStatus = sl_SetSockOpt(iSockID, SL_SOL_SOCKET, SL_SO_NONBLOCKING,
&lNonBlocking, sizeof(lNonBlocking));
if( iStatus < 0 )
{
sl_Close(iSockID);
ASSERT_ON_ERROR(SOCKET_OPT_ERROR);
}
sltimeval.tv_sec = 0;
sltimeval.tv_usec = 3000;
iStatus = sl_SetSockOpt(iSockID, SL_SOL_SOCKET, SL_SO_RCVTIMEO ,
&sltimeval, sizeof(sltimeval));
if( iStatus < 0 )
{
sl_Close(iSockID);
ASSERT_ON_ERROR(SOCKET_OPT_ERROR);
}
What is the difference between them?
Question 1)
Is that setting zero to SL_SO_RCVTIMEO, that is:
sltimeval.tv_sec = 0;
sltimeval.tv_usec = 0;
will achieve the same behavior as SL_SO_NONBLOCKING?
Question 2)
if both SL_SO_RCVTIMEO & SL_SO_NONBLOCKING are set, what will be the resulting behavior for this socket?
Thanks!
Eric