Dominik,

I am doing about the same thing as you. Try the tcp_write 
(tpcb,&buff[flag],sendLen, TCP_WRITE_FLAG_COPY); TCP_WRITE_FLAG_COPY is defined 
as 0x01. I did not have success sending with 0. I am however using 1.4.1

Hope this helps,

Paul


From: [email protected] 
[mailto:[email protected]] On Behalf Of 
Dominik Wybranczyk
Sent: Monday, August 18, 2014 4:46 AM
To: [email protected]
Subject: [lwip-users] TCP send problem

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
_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to