lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Questions about how to get a robust lwIP TCP Raw API se


From: Dinesh Pandey
Subject: Re: [lwip-users] Questions about how to get a robust lwIP TCP Raw API server application.
Date: Tue, 3 Nov 2015 21:05:11 +0530

"-Once the new TCP PCB structure is created with pcb_new(), it is passed as
an argument of all the lwIP stack callbacks. What is then the utility to
assign it to a global TCP PCB structure?"

When you want to write to the TCP connection outside of the receive callback. And yes, you can write to the TCP connection anytime (not just in the receive callback).

" I am currently tcp_close(pcb)-ing (and tcp_abort if tcp_close failed) and
then trying to recall the "new - bind - listen - accept" procedure but it
fails at tcp_bind returning the ERR_INUSE (-8) error ..."

IIRC, there is a SO_REUSEPORT equivalent flag for LWIP. Don't remember the exact name.





On Tue, Nov 3, 2015 at 7:08 PM, bom <address@hidden> wrote:
Hello there, first mail/question to this list/forum for me, hope i do it the
good way.

I am a new user of the lwIP library for a use in a Xilinx's Zynq (SoC
containing an ARM Cortex A9) embedded  *bare-metal application*. Having no
OS and hence a single thread, I am using the lwIP's Raw IP (with callbacks)
to develop a TCP server application.
That application needs to *both answer TCP "commands" *(understand sending
TCP packets depending on the received ones) and *send TCP packets
independently of the received ones *(understand even if no packets have been
received, starting the moment the connection is established).
Ok now you have the context, here are my questions :

-Once the new TCP PCB structure is created with pcb_new(), it is passed as
an argument of all the lwIP stack callbacks. What is then the utility to
assign it to a global TCP PCB structure?

-In which chronological order should I do my TCP_functions calls, knowing
that I need non-lwIP (Zynq peripherals) interrupts to trigger before being
able to answer commands? I so can't tcp_write in the recv_handler! Is it the
utility of that global TCP PCB? Is it ok/safe/*robust *to call tcp_write
outside from the lwIP callbacks' context and passing it a global TCP PCB
structure as parameter?

-When the connection is aborted by a remote host (i.e. I close my PUTTY
window and recv_handler gets a NULL pbuf), what is the good way to set my
lwIP application/connection in a clean state and ready to accept a new
connection?
I am currently tcp_close(pcb)-ing (and tcp_abort if tcp_close failed) and
then trying to recall the "new - bind - listen - accept" procedure but it
fails at tcp_bind returning the ERR_INUSE (-8) error ...

As a all-in-one question that could answer all of the above : is there a raw
API example using the tcp_close and then knowing how to automatically
relaunch the server if the connection has been aborted/reseted or link is
down? I searched in httpserver_raw and the contrib folder but none of them
seems to relaunch the connection once closed? Is there something I missed in
these examples codes?

Sorry for that long post and thank you if you came down this point, I hope
someone will have the answers to my questions. :-)
Regards.



--
View this message in context: http://lwip.100.n7.nabble.com/Questions-about-how-to-get-a-robust-lwIP-TCP-Raw-API-server-application-tp25308.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


reply via email to

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