[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] How to send a large dynamic generated http page?
From: |
ptau |
Subject: |
[lwip-users] How to send a large dynamic generated http page? |
Date: |
Fri, 27 Apr 2012 15:47:45 -0700 (PDT) |
I want to send one http page that is 200K bytes. I only have 4K byte buffer
to work with to generate the page. So I have to generate it dynamically
multiple times.
How can I send a large page in 4k interval?
I tried to insert the send_data(pcb, hs); after the first one and inside the
http_sent, did not work well. There is some internals in tcp_write that I
don't quite understand.
thank
Ptau
hs->file = file.data;
hs->left = file.len;
send_data(pcb, hs);
tcp_sent(pcb, http_sent);
static void
send_data(struct tcp_pcb *pcb, struct http_state *hs)
{
err_t err;
u16_t len;
/* We cannot send more data than space avaliable in the send
buffer. */
if (tcp_sndbuf(pcb) < hs->left)
{
len = tcp_sndbuf(pcb);
}
else
{
len = hs->left;
}
err = tcp_write(pcb, hs->file, len, 0);
if (err == ERR_OK)
{
hs->file += len;
hs->left -= len;
}
}
/*-----------------------------------------------------------------------------------*/
static err_t
http_sent(void *arg, struct tcp_pcb *pcb, u16_t len)
{
struct http_state *hs;
hs = arg;
if (hs->left > 0)
{
send_data(pcb, hs);
}
else
close_conn(pcb, hs);
return ERR_OK;
}
--
View this message in context:
http://old.nabble.com/How-to-send-a-large-dynamic-generated-http-page--tp33760820p33760820.html
Sent from the lwip-users mailing list archive at Nabble.com.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lwip-users] How to send a large dynamic generated http page?,
ptau <=