Net+OS 6.0 - socket error code EFA ULT=0xE (

Hi,

Someone had faced a socket error EFAULT after a recvfrom call? The “NET+OS 6.0 API Reference” only describes this error as “Bad Address”.

Other TCP/IP stacks return Bad Address with the buffer given to copy data is invalid, pointing a area outside de process boundaries. This is not the case of our NET+50 processor, and the buffer used in my application has also been checked before the call.

Any ideas? Someone could indicate another documentation that explains better this error?

Thanks in advance,

The ‘Bad Address’ that the error is referring to is not an IP address, but rather the pointer address for the buffer you are passing to the recvfrom() routine and/or the buffer length.

You must pre-allocate the memory for this buffer.

Cameron

Hi,

The problem with “BAD ADDRESS” comes with recvfrom used as below:

int fromlen=sizeof(from); /* actually, 16 /
while(1)
{
status = recvfrom(sock, buffer, buf_len, 0, from, &fromlen);
… /
bla,bla,bla */
}

So, the “BAD ADDRESS” happened because fromlen value changed after one recvfrom call and repeate forever. Changing the code to something link this:

int fromlen; /* actually, 16 /
while(1)
{
fromlen=sizeof(from);
status = recvfrom(sock, buffer, buf_len, 0, from, &fromlen);
if( fromlen != sizeof(from))
PRINT_DEBUG(“Warnning! fromlen != sizeof(from)!”);
… /
bla,bla,bla */
}

The “BAD ADDRESS” never happened again. But the fromlen still changing after some recvfrom calls. Odd, but the application use the buffer and the from address, it validate it. So, I conclude that the fronlen is reporting a wrong value. Why fromlen doesn’t match sizeof from(16) ?

Message was edited by: cassius

Message was edited by: cassius

Dear Cameron,

Yes, I am aware that a have to pre-allocate the buffer. The buffer that I use is statically allocated. Besides, there are no means for the TCP/IP stack check the address validit, besides verify if it is the NULL pointer.