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.

请教关于socket中的sl_Recv()函数的问题



1假设程序初始化我将socket通过sl_SetSockOpt 设置为NONBLOCKING模式

2程序正在执行LED的状态翻转,在此期间 服务器发来了2条消息  先后分别是数据“1”  “2”

3在执行完LED后,程序调用sl_Recv(iSockID,cRxBuf,5,0)接收数据  

请问cRxBuf中的数据是 “1”  还是“2”

伪码如下:

main()

{

init();

//socket设置为非阻塞模式

sl_SetSockOpt(iSockID, SL_SOL_SOCKET, SL_SO_NONBLOCKING,&lNonBlocking, sizeof(lNonBlocking));

   while(1)

  {

LEDBlinkyRoutine();//执行到该段代码时来了网络数据 “1”  “2”

sl_Recv(iSockID,cRxBuf,5,0);

  }

}