Re: [lwip-users] Call tcp_close() out of tcp_recv()-context?
Does your question have anything to do with the subject? Aside from that: yes, probably the lwip stack needs some change to work with your code. Or maybe the other way round, but I cannot tell that from here. Simon Abhijith N M wrote: Hello All, I need to implement TCP/IP through lwip stack on AT32UC3A0512. I tried using the BSD sockets of lwip stack to establish TCP/IP, but I can never ping successfully, the connected ATEML EVK1105 board. Ethernet driver are working perfectly. I think some change needs to be done to LWIP stack to create a Socket properly and send data. Pinging is failing and Data communication is failing. Please let me know a solution for this. Thanks and Regards Abhijith N.M. From: lwip-users-bounces+abhijith.mutt=quest-global@nongnu.org [lwip-users-bounces+abhijith.mutt=quest-global@nongnu.org] on behalf of goldsi...@gmx.de [goldsi...@gmx.de] Sent: 07 September 2015 23:55:15 To: Mailing list for lwIP users Subject: Re: [lwip-users] Call tcp_close() out of tcp_recv()-context? Karl Karpfen wrote: My question: can I do a tcp_close() from within my_recv() which is called in lwIP's receive-context Yes you can. And the lwIP API allows it. (which possibly may be a receive-IRQ)? No. Unless you take special action to prevent concurrent access to the lwIP core (i.e. block ETH IRQ when calling lwIP functions from main loop), receive functions must not be called from ISR. If that is the case, most often the creator of your lwIP port has done something wrong. This has been the case for some microcontroller vendor's ports in the past. Simon ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users ---Disclaimer-- This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Opinions, conclusions and other information in this transmission that do not relate to the official business of QuEST Global and/or its subsidiaries, shall be understood as neither given nor endorsed by it. Any statements made herein that are tantamount to contractual obligations, promises, claims or commitments shall not be binding on the Company unless followed by written confirmation by an authorized signatory of the Company. --- ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] Call tcp_close() out of tcp_recv()-context?
It depends on what you mean by "context". If you don't have any kind of OS running, you have one thread and interrupt handlers, you can safely call lwIP RAW API functions from your main thread. It is not safe to also call from interrupts. If your application depends on interrupts, just set a flag or equivalent and let the main thread react to that. If you have an OS, you have to keep everything on one thread or use another API. -- ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] Call tcp_close() out of tcp_recv()-context?
Hi Karl, In general you should not call any call back function out of the TCP context. One way is raise a flag externally and in the poll call back check this flag. If it is set call the tcp_close … inside the poll call back BR, Noam. From: lwip-users-bounces+noam=silrd@nongnu.org [mailto:lwip-users-bounces+noam=silrd@nongnu.org] On Behalf Of Karl Karpfen Sent: Monday, September 07, 2015 2:02 PM To: Mailing list for lwIP users Subject: [lwip-users] Call tcp_close() out of tcp_recv()-context? Hi, I'm using raw-API within my application and have defined a receive-callback by using tcp_recv(). Now it may happen a close-command (from my own protocol running on top of TCP/IP) is received within this receive-callback. My question: is it allowed to call tcp_close() out of the context of this receive-function? Thanks! Karl This footnote confirms that this email message has been scanned by PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses. This footnote confirms that this email message has been scanned by PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses. ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] Call tcp_close() out of tcp_recv()-context?
2015-09-07 14:17 GMT+02:00 Sergio R. Caprile: > It depends on what you mean by "context". > > The structure is as follows (all non-OS and with RAW API): With tcp_recv() I set up a receive-callback function my_recv(). my_recv() is triggered by lwIP whenever some data are received. Some of these data may contain an information "connection will be closed by host". My question: can I do a tcp_close() from within my_recv() which is called in lwIP's receive-context (which possibly may be a receive-IRQ)? Thanks! ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
[lwip-users] Call tcp_close() out of tcp_recv()-context?
Hi, I'm using raw-API within my application and have defined a receive-callback by using tcp_recv(). Now it may happen a close-command (from my own protocol running on top of TCP/IP) is received within this receive-callback. My question: is it allowed to call tcp_close() out of the context of this receive-function? Thanks! Karl ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] Call tcp_close() out of tcp_recv()-context?
There is no "possibly" here, if you call lwIP RAW API functions from within an interrupt, you can't also call them from the main thread or other nested interrupts. All calls to lwIP RAW API functions must happen from within the same context, they can't interrupt themselves. Check the examples in the contrib tree. Read the wiki http://lwip.wikia.com/wiki/Raw/native_API You can call tcp_close from your my_recv. Make sure your "my_send" (if any)is not interruptable by your my_recv -- ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] Call tcp_close() out of tcp_recv()-context?
Hello All, I need to implement TCP/IP through lwip stack on AT32UC3A0512. I tried using the BSD sockets of lwip stack to establish TCP/IP, but I can never ping successfully, the connected ATEML EVK1105 board. Ethernet driver are working perfectly. I think some change needs to be done to LWIP stack to create a Socket properly and send data. Pinging is failing and Data communication is failing. Please let me know a solution for this. Thanks and Regards Abhijith N.M. From: lwip-users-bounces+abhijith.mutt=quest-global@nongnu.org [lwip-users-bounces+abhijith.mutt=quest-global@nongnu.org] on behalf of goldsi...@gmx.de [goldsi...@gmx.de] Sent: 07 September 2015 23:55:15 To: Mailing list for lwIP users Subject: Re: [lwip-users] Call tcp_close() out of tcp_recv()-context? Karl Karpfen wrote: > My question: can I do a tcp_close() from within my_recv() which is > called in lwIP's receive-context Yes you can. And the lwIP API allows it. > (which possibly may be a receive-IRQ)? No. Unless you take special action to prevent concurrent access to the lwIP core (i.e. block ETH IRQ when calling lwIP functions from main loop), receive functions must not be called from ISR. If that is the case, most often the creator of your lwIP port has done something wrong. This has been the case for some microcontroller vendor's ports in the past. Simon ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users ---Disclaimer-- This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Opinions, conclusions and other information in this transmission that do not relate to the official business of QuEST Global and/or its subsidiaries, shall be understood as neither given nor endorsed by it. Any statements made herein that are tantamount to contractual obligations, promises, claims or commitments shall not be binding on the Company unless followed by written confirmation by an authorized signatory of the Company. --- ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] Call tcp_close() out of tcp_recv()-context?
Karl Karpfen wrote: My question: can I do a tcp_close() from within my_recv() which is called in lwIP's receive-context Yes you can. And the lwIP API allows it. (which possibly may be a receive-IRQ)? No. Unless you take special action to prevent concurrent access to the lwIP core (i.e. block ETH IRQ when calling lwIP functions from main loop), receive functions must not be called from ISR. If that is the case, most often the creator of your lwIP port has done something wrong. This has been the case for some microcontroller vendor's ports in the past. Simon ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users