lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] 1.4.0.rc1: How to use netconn-API for non-blocking conn


From: address@hidden
Subject: Re: [lwip-users] 1.4.0.rc1: How to use netconn-API for non-blocking connect?
Date: Tue, 19 Oct 2010 19:11:56 +0200
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; de; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4

Benjamin Schelte wrote:

However the call to the function “netconn_connect” always returns ERR_INPROGRESS, but after that nothing more happens.

Neither delaying the task and processing later, nor directly calling “netconn_write” worked (it also returned ERR_INPROGRESS).

Of course it does, that's what you told it to: nonblocking means the call is enqueued (your application thread *does* get blocked a while, but only for the time the lwip-thread needs to enqueue and send the SYN). If this succeeds, ERR_INPROGRESS is returned.

If you were using a socket (instead of a netconn), select would mark the socket as writable. Since you are using a netconn, you will have to implement this on your own: the callback you can pass to netconn_new_with_callback() will be called with enum netconn_evt == NETCONN_EVT_SENDPLUS for your netconn when the connection is established.

However, this can be quite a pain to implement on your own, so you might want to use sockets instead if you can live with the extra copying that API imposes (compared to the netconn API): using sockets, you can simply connect and then wait (with a timeout) using select(), just as you would do on any other socket implementation/OS.

Simon

reply via email to

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