W5100이 메시지를 10byte 수신 후
rLen = recv(s,buf,20);
을 호출하면, rLen 이 20으로 리턴 됩니다.
수신한 메시지 길이만 리턴 받을 수 있나요?
rLen = recv(s,buf,1);
위 처럼 호출하고, 수신한 패킷을 분석하여,
다음 바이트 수신 여부를 결정해야 하나요?
///recv()//////////////////////////////////////////
/**
@brief This function is an application I/F function which is used to receive the data in TCP mode.
It continues to wait for data as much as the application wants to receive.
@return received data size for success else -1.
*/
uint16 recv(SOCKET s, /< socket index */
uint8 * buf, /< a pointer to copy the data to be received */
uint16 len /**< the data size to be read */
)
{
uint16 ret = 0;
#ifdef DEF_IINCHIP_DBG
PP(“recv()\r\n”);
#endif
if (len > 0)
{
recv_data_processing(s, buf, len);
IINCHIP_WRITE(Sn_CR(s), Sn_CR_RECV);
/* +20071122[chungs]:wait to process the command... */
while (IINCHIP_READ(Sn_CR(s)))
;
/* ------- */
ret = len;
}
return ret;
}
//////////////////////////////////////////////////