|
From: | Werner Motz |
Subject: | [lwip-users] Raw api + multiple TCP Connections |
Date: | Mon, 22 May 2017 12:29:21 +0200 |
Hello, I am using lwip 2.0.2 RAW API and I have a question depending multiple TCP Connections. I create two connections without problems. Over each of them I can send and receive data. When a single client sends me data every 1ms, my receive callback function (tcp_recv(pcb, myCallback1)) gets periodically called. In myCallback1 I handle the received data and answer. This works fine and on Wireshark I am able to reach a communication rate of about 6Mbit/s without data loss. (lwip stats without errors or drops…) Now if I try to receive data at the same time from the second client (every 5ms) and using annother callback function (tcp_recv(pcb, myCallback2)) my system crushes (Hard fault Handler). My first thought was that a receive callback cannot be called from two clients at the same time so I did the following: I synchronized the client’s sending intervals (LabView) and changed the send timing to Client_1 send ---> 3 ms delay ---> Client_2 send ---> 3ms delay ---> Client_1 send….. Unfortunately this does not work either although I am sending slower with less data. Now my question: How to handle received data from multiple connections? 1.) Is there a better way than using two different callback functions? Polling? 2.) What does lwip do if two clients send me data at the same time? 3.) Is the receive callback (myCallback1/2) blocking? I debugged my lwip_stats but they show no errors. I am looking forward to your answer(s). |
[Prev in Thread] | Current Thread | [Next in Thread] |