[lwip-users] Missing ACKs in Websocket echo server
Hello, I am trying to write up a simple Websocket echo server on an embedded device with lwip. Looking at the Wireshark traces, it appears that I am missing ACKs from the server, but the Websocket handshake and packets themselves seem to be well-formed. I think this is leading to failed behavior. The first issue is that connection is inconsistent. Sometimes an error is returned, sometimes the client seems to connect successfully. Then the second issue is that after the client sends a simple test frame, the server responds with an echo, but this echo is not picked up by the client. I've attached the wireshark trace, showing first a failed connection, then a "successful" one, then a message and echo. If these problems are indeed due to missing ACK's, what am I doing wrong in the tcp_recv callback? I do call tcp_recved(pcb, p->tot_len); Is there something else I need to be doing? Thanks, Mike Echo server - 1 failed connection, 1 connection, 1 send.pcapng Description: Binary data ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] Missing ACKs in Websocket echo server
I've also attached a successful echo session with the server at echo.websocket.org for reference. Thanks, Mike On 6/19/2014 9:22 AM, Mike He wrote: Hello, I am trying to write up a simple Websocket echo server on an embedded device with lwip. Looking at the Wireshark traces, it appears that I am missing ACKs from the server, but the Websocket handshake and packets themselves seem to be well-formed. I think this is leading to failed behavior. The first issue is that connection is inconsistent. Sometimes an error is returned, sometimes the client seems to connect successfully. Then the second issue is that after the client sends a simple test frame, the server responds with an echo, but this echo is not picked up by the client. I've attached the wireshark trace, showing first a failed connection, then a "successful" one, then a message and echo. If these problems are indeed due to missing ACK's, what am I doing wrong in the tcp_recv callback? I do call tcp_recved(pcb, p->tot_len); Is there something else I need to be doing? Thanks, Mike Echo from echo.websocket.org.pcapng Description: Binary data ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] Missing ACKs in Websocket echo server
I suggest that you use breakpoints and actually debug your code. Many of us here are willing to help on networking issues and even catch lwIP bugs, but it is sort of near to impossible to guess what the problem in your code is just by looking at a wireshark capture file. I also suggest you download the examples in the contrib tree and study them. There you will see how a tcp_recv() callback has to work. tcp_recved() tells the stack you have taken care of the data, so it can manage ACKs, but to work, the stack needs to be called when an Ethernet frame (for example) arrives. You provide no info on what you are doing and how you call the stack, whether you are using bare metal or an RTOS, and I could guess you use the raw API because you mentioned tcp_recved() and tcp_recv(). Have you confirmed your tcp_recv() function is called on incoming frames and there is no delay there ? ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users