[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] lwip netconn_recv issue
From: |
Martin Velek |
Subject: |
Re: [lwip-users] lwip netconn_recv issue |
Date: |
Fri, 3 May 2013 21:34:21 +0200 |
Hello,
you are using at least 4096 of stack (actually much more because
netconn_* needs also some). Probably the death is caused by the stack
overflow, check how many bytes did you allocated for the task. I do
not know how to detect it in the µC/OS.
Best
Martin
On Thu, May 2, 2013 at 4:38 AM, hongyancl <address@hidden> wrote:
> hello,
> I want to creat one task in ucos with lwip.
> Following the code :
>
> static void
> udpecho_thread(void *arg)
> {
> static struct netconn *conn;
> static struct netbuf *buf;
> static ip_addr_t *addr;
> static unsigned short port;
> char buffer[4096];
> err_t err;
> LWIP_UNUSED_ARG(arg);
>
> conn = netconn_new(NETCONN_UDP);
> LWIP_ASSERT("con != NULL", conn != NULL);
> netconn_bind(conn, NULL, 7);
>
> while (1)
> {
> err = netconn_recv(conn, &buf);
>
> if (err == ERR_OK)
> {
> addr = netbuf_fromaddr(buf);
> port = netbuf_fromport(buf);
> netconn_connect(conn, addr, port);
> netbuf_copy(buf, buffer, buf->p->tot_len);
> buffer[buf->p->tot_len] = '\0';
> netconn_send(conn, buf);
> LWIP_DEBUGF(LWIP_DBG_ON, ("got %s\n", buffer));
> netbuf_delete(buf);
> }
> }
> }
>
> but,after i creat the task ,my system is dead.
>
> please give me some asvice.
>
>
>
> --
> View this message in context:
> http://lwip.100.n7.nabble.com/lwip-netconn-recv-issue-tp21383.html
> Sent from the lwip-users mailing list archive at Nabble.com.
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/lwip-users