lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] TCP send problem


From: Dominik Wybrańczyk
Subject: [lwip-users] TCP send problem
Date: Mon, 18 Aug 2014 10:46:16 +0200

Hello, my name is Dominik and this is my first post to lwip mailing list. I am working on stm32f4 IOT project where I want to use RAW lwip. I am basing on standalone tcp echo example made for STM32F4DIS-BB (Embest). I have already designed some drivers, and they are working great (like connection accpet, connection close, receiving handler, parser etc). But I have some problems with sending data. Everything works well when I am sending messages up to 38B, but if I send more than they are corrupted. 

Here is how it works:
My device is server, and I connect as clinet with my PC. I am sending some data from PC to my device. Than when I have received some information form PC, I parse it and want to respond with another data.
Firstly I am checking "freespace" in sending container by using tbp_sndbuf() like:
freespace = tcp_sndbuf(tpcb);
Usually there are a lot of space (like 2500B, but I also have handler for the situation when there are more data to send than container can handle...) so after that I am passing message to tcp_write like this:
wr_err = tcp_write(tpcb,&buff[flag], sendLen,0);
Variable wr_err is always 0, so "mem write" is OK. After that to make sure the message will be send now I call:
tcp_output(tpcb);

Sadly, the information I am receivng on PC is wrong every time when I am sending more than 38B. Usually its shorter and the message is like: 
corrupted_data + SMALL_PART_THAT_IS_OK + other_corrupted_data.

To be honest I am not getting the idea with the tcp_send() callback, but I assume that I dont need it in this simple example.

I am using lwip_v1.3.2 as in example. Should I update it?

What should I look at? Am I doing something wrong?

Kind Regards
Dominik

reply via email to

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