I admit my understanding of threads is not the best. I understand the use of a callback API, but I don’t want to
send data back in a callback only in order of receiving a TCP/IP message. I want to send independently from receiving. I am aware that there is only one tcpip thread which is responsible for tcp_input and output. My question is how to enqueue data via tcp_write() without running into a conflict. Is there a callback function which is called independently from receiving in which I could send my data? Von: lwip-users [mailto:[email protected]] Im Auftrag von Dirk Ziegelmeier Gesendet: Donnerstag, 11. Mai 2017 12:54 An: Mailing list for lwIP users Betreff: Re: [lwip-users] lwip 2.0.2 + freertos + ARM7 Hello Werner, the following sentences are NOT meant in a harsh way, but as a good and polite advice to you: You really need to get educated in threading, locking and interrupt issues when you develop for a multithreaded system. Without understanding these, you will quite surely end up with a system that "usually works" but has occasional hiccups a few times a day. The question you are asking is out of scope of this mailing list, it is a question about general threading design in an embedded system. Please understand I don't want to help you there, that would consume too much time. It is not a question that can be answered shortly in a few sentences and without understanding your application. If you use threads, you may want to use netconn or socket API if that's easier for you. You still can use the callback API, but you need to use tcpip_callback() or LOCK_TCPIP_CORE (if you configured lwIP to use core locking) to sync with lwIP thread. Dirk On Thu, May 11, 2017 at 12:07 PM, Werner Motz <[email protected]> wrote: Thank u for your answer. But what is the proper way to use tcp_write() and tcp_output()? Where can I use them? Would it be correct to do: LOCK_TCPIP_CORE(); tcp_write(); tcp_output(); UNLOCK_TCPIP_CORE(); If I do so, how can I ensure, that I can still receiving data? Don’t I block the RX side? Sorry, I am a noob but how can I ensure that I am in the tcpip thread? Von: lwip-users [mailto:lwip-users-bounces+motz <mailto:lwip-users-bounces%2Bmotz> [email protected]] Im Auftrag von Dirk Ziegelmeier Gesendet: Mittwoch, 10. Mai 2017 19:04 An: Mailing list for lwIP users Betreff: Re: [lwip-users] lwip 2.0.2 + freertos + ARM7 Sounds like you are calling lwIP functions from another thread than the lwIP thread, in your case the CAN thread. See http://www.nongnu.org/lwip/2_0_x/pitfalls.html Dirk _______________________________________________ lwip-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/lwip-users
_______________________________________________ lwip-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/lwip-users
