I do have some more questions on this topic... I decided to test the speed improvements using the RAW API. This API allows me to use only one thread to do whatever I want instead of two threads using the sequential API because the "recv" is blocking and I need to send data in the idle time.
1- I just read from the Wiki that the RAW API can only be used by the main thread?? In my project, I need the main thread to call "vTaskStartScheduler()" to run FreeRTOS for multithreading, which never returns. So, I can't use my main thread to manage the RAW API, but I can call "tcp_new", "tcp_bind", "tcp_listen" and "tcp_accept" before. Is that sufficient? 2- What do I need to call to use/init the RAW API? For the sequential, I was using sys_init(), mem_init(), memp_init(), pbuf_init(), netif_init(), tcpip_init(EthernetConfigInterface, NULL). I'm not sure if I still need those... or if I'm missing something. 3- I haven't found it, so I think it would be good to have a little resume of what are the #defines needed by all the API. For example, if I want to use the RAW API, I must absolutly define some values in the lwipopts.h file. Personally, I'm not sure I have everything configured ok.. Thanks, Downy Jonathan Larmour wrote: > > DownyTif wrote: >> Hi all, >> >> I was wondering what API I should use to do what I want to do. By the >> way, >> I'm new to the mail-list/forum and lwip world. I tried to find the >> differences between the Raw, sockets or sequential (netconn) APIs, but I >> haven't found anything useful. > > http://lwip.wikia.com/wiki/LwIP_Wiki has a lot of stuff about the APIs. In > essence the raw API is event-driven, the sequential (netconn) API, is a > more traditional API with calls to e.g. netconn_write() which can block > until the operation completes, and the sockets API is the same sort of > thing as the sequential API, but using the well-known BSD sockets > functions (like socket(), bind(), listen() accept(), etc.). > > Each API (raw->sequential->sockets) in turn has more overhead (both code > and data) and is slightly slower than the previous one, and for some > hardware, you can get much better performance with the raw or sequential > APIs than the sockets API in some situations, but that doesn't mean the > sequential or sockets APIs are slow. If performance is critical for you > (and your other mail implies this might be tree) it could be that the raw > API is a better choice. Although you have to do more things yourself with > the raw API. > >> So, I was thinking that maybe the sequential API (netconn) was not the >> way >> to go. > > It's unrelated to your other mail about large packet sizes. An > event-driven model such as the raw API affects your program design a lot. > Some people like the familiarity of the sockets API if they've used it > elsewhere, or if they are reusing existing code. It's a choice with > trade-offs between them, which is why lwIP has all three! > > 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. > ------["The best things in life aren't things."]------ Opinions==mine > > > _______________________________________________ > lwip-users mailing list > [email protected] > http://lists.nongnu.org/mailman/listinfo/lwip-users > > -- View this message in context: http://www.nabble.com/Choosing-the-right-lwip-API...-tp21575028p21713721.html Sent from the lwip-users mailing list archive at Nabble.com. _______________________________________________ lwip-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users
