lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Receving file from web server using raw TCP


From: Andy Pont
Subject: [lwip-users] Receving file from web server using raw TCP
Date: Tue, 12 Jan 2016 14:10:35 -0000

Hello,

I am working on a bare metal project using NO_SYS=1 implementing a simple
HTTP client request to a remote web server.  The responses from the web
server (Apache+PHP) are either a custom HTTP error code such as 601, 701,
etc. which have a specific meaning or 200 (standard HTTP OK response) in
which case a file approximately 10MiB in size is returned by the web server.

When the response is one of the error conditions and it fits within a single
TCP packet (TCP_MSS is 536) then everything works as expected and the
receive callback function registered with tcp_recv() is called only once.

If the server sends the HTTP OK response, the receive callback function only
gets called three times before lwIP starts to generate multiple errors along
the following lines:

Received 00000001 packets
Received HTTP response code: 200
Assertion "pbuf_free: p->ref > 0" failed at line 691 in
net/lwIP/src/core/pbuf.c
Assertion "pbuf_free: p->ref > 0" failed at line 691 in
net/lwIP/src/core/pbuf.c
Received 00000002 packets
Assertion "memp_malloc: memp properly aligned" failed at line 436 in
net/lwIP/src/core/memp.c
Assertion "pbuf_alloc: pbuf q->payload properly aligned" failed at line 296
in net/lwIP/src/core/pbuf.c
Assertion "memp_free: mem properly aligned" failed at line 467 in
net/lwIP/src/core/memp.c
Assertion "memp_malloc: memp properly aligned" failed at line 436 in
net/lwIP/src/core/memp.c
Assertion "pbuf_alloc: pbuf q->payload properly aligned" failed at line 296
in net/lwIP/src/core/pbuf.c
Assertion "memp_free: mem properly aligned" failed at line 467 in
net/lwIP/src/core/memp.c
Received 00000003 packets
Assertion "memp_malloc: memp properly aligned" failed at line 436 in
net/lwIP/src/core/memp.c
Assertion "pbuf_alloc: pbuf q->payload properly aligned" failed at line 296
in net/lwIP/src/core/pbuf.c

Looking at the network traffic then I can see the three TCP packets and they
are correct in that they contain the HTTP response headers and the first
part of the file being transmitted.

Am I correct in assuming that the receive callback should get called
filesize/TCP_MSS times?  Other than leaving the lopp running that calls
sys_check_timeouts() is there something I have missed?

TIA.

Andy.




reply via email to

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