lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] HTTP server help needed


From: Navcon - Pedro Paulo Santos
Subject: Re: [lwip-users] HTTP server help needed
Date: Wed, 7 Apr 2010 09:09:54 -0300

Hi Stojan,

No, I created my own HTTP handler code, but I have an example of one made by Luminary Micro. My version is much more simple. I just process the HTTP packeges in tcp_recv callback function. Depending on what is the client looking for, I create a different amont of data an concatenate it with the HTTP header I wrote in memory, and then I send it with tcp_write (). I just had to put (and I'm still puting) some effort in the way the big packages are transmitted, because I want to avoid Nagle's algoritm (I have low memory).

Regards,
Pedro Paulo.



----- Original Message ----- From: "Stojan Kovacevic" <address@hidden>
To: <address@hidden>
Sent: Wednesday, April 07, 2010 4:30 AM
Subject: [lwip-users] HTTP server help needed


Hi,
I need some help setting up an http server, since you 've got it
working. First, have you used http files from /contrib folder? Second,
did you make a special thread for it, or does it use tcpip_thread?

Thanks in advance,
Stojan Kovacevic

address@hidden wrote:
Send lwip-users mailing list submissions to
address@hidden

To subscribe or unsubscribe via the World Wide Web, visit
http://lists.nongnu.org/mailman/listinfo/lwip-users
or, via email, send a message with subject or body 'help' to
address@hidden

You can reach the person managing the list at
address@hidden

When replying, please edit your Subject line so it is more specific
than "Re: Contents of lwip-users digest..."


Today's Topics:

   1. lwIP malloc fail (Navcon - Pedro Paulo Santos)


----------------------------------------------------------------------

Message: 1
Date: Tue, 6 Apr 2010 12:38:19 -0300
From: "Navcon - Pedro Paulo Santos" <address@hidden>
Subject: [lwip-users] lwIP malloc fail
To: <address@hidden>
Message-ID: <address@hidden>
Content-Type: text/plain; charset="iso-8859-1"

Hi all!

I'm having a problem in trying to make a system with lwIP that sends a large file with TCP from an external serial Flash memory.

I use the following logic: read certain amont of data from the external memory, send over TCP with tcp_write (), read more data, send again, and there goes on. I made a function to handle lack of memory because of Nagle's algoritm (because I have little memory and can't prepare a large TCP message), and use tcp_output () to force the send of the amont of data. The problem is that after some transfers (no more than 15 tcp transfers) the program doesn't find memory to alloc in the following lines of tcp_enqueue () function:

    /* Allocate memory for tcp_seg, and fill in fields. */
    seg = memp_malloc(MEMP_TCP_SEG);
    if (seg == NULL) {
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_enqueue: could not allocate memory for tcp_seg\n"));
      goto memerr;
    }

In my thinking, the tcp_output () function should free memory for the further transfers so that I can transfer any amont of data if I make a lot of consecutive "small" transfers.

It occurs even if I send really small messages, with 20 bytes, for example. I already tried to edit lwipopts.h raising TCP_SND_BUF, TCP_WND, TCP_MSS, PBUF_POOL_SIZE, MEM_SIZE... but I got no good results.

Do I have to free memory, myself, in any part of the lwIP implementation?
(I already free the pbuf that my recv function returns as callback after the read)

Anyone have a suggestion of what could be the problem?

Informations: I'm using an ARM microcontroller with 64kB SRAM and 256kB flash. I already made an HTTP server into it, but it spends very little memory. My external serial (SPI) flash memory have 128MB.

Thanks to all!

Pedro Paulo.


__________ Informação do ESET NOD32 Antivirus, versão da vacina 4628 (20091122) __________

A mensagem foi verificada pelo  ESET NOD32 Antivirus.

http://www.eset.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.gnu.org/pipermail/lwip-users/attachments/20100406/45825ecd/attachment.html

------------------------------

_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users

End of lwip-users Digest, Vol 80, Issue 4
*****************************************



--
Stojan Kovacevic, M.Sc.
Engineer / UACB
Tel +381-(0)21-4801-127
Fax +381-(0)21-450-721
address@hidden

RT-RK Group
Fruskogorska 11
21000 Novi Sad
Serbia
www.rt-rk.com



_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users


__________ Informação do ESET NOD32 Antivirus, versão da vacina 4628 (20091122) __________

A mensagem foi verificada pelo  ESET NOD32 Antivirus.

http://www.eset.com




__________ Informação do ESET NOD32 Antivirus, versão da vacina 4628 (20091122) 
__________

A mensagem foi verificada pelo  ESET NOD32 Antivirus.

http://www.eset.com







reply via email to

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