lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] lwip_accept acceptmbox is NULL


From: Emmanuel Baguia Jr.
Subject: Re: [lwip-users] lwip_accept acceptmbox is NULL
Date: Tue, 7 Oct 2008 18:41:56 -0700 (PDT)

Applying what you have suggested gave me relief! By replacing NULL with INADDR_ANY everything worked now. Thank you very much. Next time it will be right to check the return values of netconn functions.

Jonathan Larmour <address@hidden> wrote:
Emmanuel Baguia Jr. wrote:
> Here are some code snippets using the APIs:
>
> struct netconn *conn, *newconn;
> conn = netconn_new(NETCONN_TCP);
> printf("http_test: socket created !\n");
> netconn_bind(conn, NULL, 8084);

I don't think you should be using NULL here. You should pass in IP_ADDR_ANY
instead.

> printf("http_test: socket binded !\n");
> netconn_listen(conn);
> printf("http_test: socket listen !\n");
> // Where I placed the acceptmbox initialization
> while( 1 )
> {
> newconn = netconn_accept(conn);
> printf("http_test: socket accept !\n");
> }
> netconn_close(conn);
> Until I noticed that I needed to initialize the acceptmbox if it is null
> after calling netconn_listen and before calling the netconn_accept.
> if( conn->acceptmbox == NULL )
> {
> conn->acceptmbox = sys_mbox_new(DEFAULT_ACCEPTMBOX_SIZE);
> }
>
> Then everything worked! :) Is there a way to do this in the
> lwip/socket.h? Or maybe I just missed something?

It would be good to check the return values of the netconn* functions.

Jifl
--
eCosCentric Limited http://www.eCosCentric.com/ The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK. Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
------["Si fractum non sit, noli id reficere"]------ Opinions==mine


_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users


reply via email to

[Prev in Thread] Current Thread [Next in Thread]