lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Basic TCP server problem


From: Sameer Ahmad
Subject: [lwip-users] Basic TCP server problem
Date: Thu, 11 Apr 2024 11:52:13 +0100

Hello,
I am new to LWIP and have been working on a TCP server on my board with a STM32F429ZI and my
PHY is a DP83848C. The LWIP version being used is v2.1.2.  I am using raw API and copied the echo
server example that is provided and have changed the tcp_server_send function but I not sure if this was
the right approach for what I want to do. I have separate pbufs that are used for transmitting that are used in a rotation, these pbufs are initialized in the server_init. This is so that I do not accidently
overwrite a buffer somehow.

I have a TCP server running which has packets being sent to it every 50 ms. These packets have
different lengths which I handle and respond to accordingly in my ValidatePacket() and  ProcessPacket() packet which stores the data I want to send in an array, this array is then
copied into the payload buffer and sent with tcp_write.

This setup has worked very well however there are times when a packet is transmitted later than normal,
which I am guessing is a retransmission of the packet but this is too slow (> 50 ms). This seems to
happen randomly, I have not yet found a pattern to what the problem is. I have used the debug
messages to see if I can find something however, this has yielded no problems, memory seems to
completely fine throughout the process.

I do not have a pcap file yet, since the system that is sending packets is not something I can monitor
using wireshark however I am able to get the tcpdump from the client which might be of use. In the
meantime I am trying to write my own client to try and replicate the real client and use wireshark.

In the tcpdump I have two examples of this problem occuring. The server is at x.x.x.78 whilst the client is
from x.x.x.3. In the first example the client packet is sent in line 6 and the board's response happens at
line 10 which is too late. In the second example, client sends a packet at line 46, board responds at line
52, again too slow.

In the past I have tried upgrading the LWIP files to 2.1.3 and 2.2.0 however this did not fix my problem. If
you have any suggestions or find some problems with my code, please let me know.

Attached is my tcp_server file and tcpdump file.

Thank you in advance,
Sam

Attachment: tcp_server.c
Description: Text document


reply via email to

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