[lwip-users] Problem with lwip_select under Nucleus
From:
brivero
Subject:
[lwip-users] Problem with lwip_select under Nucleus
Date:
Mon, 28 May 2007 17:06:22 +0200
Hello again.
I had a look at the points you mentioned to me:
First of all, I have checked that MSG_DONTWAIT in
the flags to the recv operation, and O_NONBLOCK to the socket options are
both set to zero. In fact, both flag fields are completely zero. So that
the socket should be blocking, am I right?
>Take a look at the lwip_recvfrom() function. Can you check the
following when you call it by adding some extra debugging:
> - that sock->lastdata is NULL. OK, it is null
> - that buf returned by netconn_recv() is NULL. It is null too.
>If that is the case, take a look at netconn_recv(). This can
return NULL for all sorts of reasons. Add debugging (e.g. a printf)
to each one and >see which case is failing.
Next, I specify the failing case, which shows the
reason for which the function returns NULL.
if (p != NULL) { len = p->tot_len; conn->recv_avail -=
len; } else
<<<<<<<<<<<<<<<<<<<<<<<<<
IT GETS INTO THIS ELSE len = 0;
printf("\n Entra en el ELSE, Chkp1\n"); /* Register event with callback */ if (conn->callback) (*conn->callback)(conn,
NETCONN_EVT_RCVMINUS, len);
printf("\n Entra en el Callback, Chkp2\n");
/* If we are closed, we indicate that
we no longer wish to receive data by setting conn->recvmbox
to SYS_MBOX_NULL. */ if (p == NULL) {
<<<<<<<<<<<<<<<<<<<<<<<<<
IT GOES INTO THIS IF (p==NULL) memp_free(MEMP_NETBUF, buf); sys_mbox_free(conn->recvmbox); conn->recvmbox = SYS_MBOX_NULL; return NULL;
<<<<<<<<<<<<<<<<<<<<<<<<<
RETURNS NULL }
.... .... ....
return buf; }
The problem seems to be that it is receiving that null p. I would thank
any advice.
Thank you very much for your help and for using your
time for this purpose.