完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
最近在调试http的应用,打算让网页输出一个表格,表格应该有250行
但实际上输出只有22行, static char http_buf[512]={0}; /*-----------------------------------------------------------------------------------*/ static err_t http_recv(void *arg, struct tcp_PCB *pcb, struct pbuf *p, err_t err)//处理输入数据 { struct http_state *hs; data = p->payload;//把接收到的数据指针交给data for(i=0;i<250;i++) { //AlARM_Record_Read(&Alarm_record,i);//刷新数据 Alarm_Record_Read(&Alarm_record,(i)%ALARM_RECORD_PAGE_AMOUNT);//刷新数据 //i=i%ALARM_RECORD_PAGE_AMOUNT; ret=sprintf(http_buf, " ret+=sprintf(http_buf+ret, " %04d | %03d | %03d | ",Alarm_record.AlarmEvent.Zone,Alarm_record.AlarmEvent.EventCode,Alarm_record.AlarmEvent.EventType);ret+=sprintf(http_buf+ret," %04d-%2d-%2d ",Alarm_record.AlarmEvent.Time.tm_year,Alarm_record.AlarmEvent.Time.tm_mon,Alarm_record.AlarmEvent.Time.tm_mday); | ",Alarm_record.AlarmEvent.Time.tm_hour,Alarm_record.AlarmEvent.Time.tm_min,Alarm_record.AlarmEvent.Time.tm_sec); ret+=sprintf(http_buf+ret,"%2d:%02d:%02d ret+=sprintf(http_buf+ret," %d | %d | ",Alarm_record.AlarmFlag[2],Alarm_record.AlarmFlag[3]);ret+=sprintf(http_buf+ret, " //i=i%ALARM_RECORD_PAGE_AMOUNT; //for(j=0;j++;j hs->file =(char*)&http_buf;// hs->left = ret; send_data(pcb, hs); tcp_output(pcb); tcp_sent(pcb, http_sent); tcp_output(pcb); } //tcp_write(pcb,http_buf,sizeof(http_buf),0); memset(http_buf,0,sizeof(http_buf));//清空数据 } } |
相关推荐
10个回答
|
|||||
帮顶....
|
|
|
|
static char http_buf[512]={0}; <--------- buffer 太小了, http 隨便一個文件都幾k起
|
|
|
|
|
|
|
|
这几天在做Lwip TCP服务器时,遇到了一些问题,和你的情况有点雷同,希望对你有帮助。
数据量是16K,每次1.2K左右,连续发15次,每5s发送一次,但是在调试过程中每次发11次就发不出去了 改变了#define __LWIPOPTS_H__文件里 #define TCP_SND_BUF (120*TCP_MSS) #define TCP_SND_QUEUELEN ((120 * (TCP_SND_BUF) + (TCP_MSS - 1))/(TCP_MSS)) 后,就没问题。 |
|
|
|
#define TCP_MSS (1500 - 40) /* TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */
/* TCP sender buffer space (bytes). */ #define TCP_SND_BUF (4*TCP_MSS) /* TCP sender buffer space (pbufs). This must be at least = 2 * TCP_SND_BUF/TCP_MSS for things to work. */ #define TCP_SND_QUEUELEN (6* TCP_SND_BUF)/TCP_MSS 我的是这样的 我试试 |
|
|
|
数据量大的话,把#define __LWIPOPTS_H__里的参数往大里调调,但是操作不当,容易出现问题。比如
#define MEM_SIZE (200*1024) /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application sends a lot of data out of ROM (or other static memory), this should be set high. */ #define MEMP_NUM_PBUF 100 /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One per active UDP "connection". */ #define MEMP_NUM_UDP_PCB 5 /* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections. */ #define MEMP_NUM_TCP_PCB 30 /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections. */ #define MEMP_NUM_TCP_PCB_LISTEN 30 /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments. */ #define MEMP_NUM_TCP_SEG 200 /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active timeouts. */ #define MEMP_NUM_SYS_TIMEOUT 3 /* ---------- Pbuf options ---------- */ /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */ #define PBUF_POOL_SIZE 200 看你自己的内存使用情况! |
|
|
|
开大了不行
..OutPutTS1106-GTA.axf: Error: L6406E: No space in execution regions with .ANY selector matching os_cpu_c.o(.data). ..OutPutTS1106-GTA.axf: Error: L6406E: No space in execution regions with .ANY selector matching lanmanager.o(.data). ..OutPutTS1106-GTA.axf: Error: L6406E: No space in execution regions with .ANY selector matching wdg.o(.data). ..OutPutTS1106-GTA.axf: Error: L6406E: No space in execution regions with .ANY selector matching sample_http.o(.data). ..OutPutTS1106-GTA.axf: Error: L6406E: No space in execution regions with .ANY selector matching mobl_op.o(.data). ..OutPutTS1106-GTA.axf: Error: L6406E: No space in execution regions with .ANY selector matching mobl_op.o(.data). ..OutPutTS1106-GTA.axf: Error: L6406E: No space in execution regions with .ANY selector matching mobl_op.o(.data). ..OutPutTS1106-GTA.axf: Error: L6406E: No space in execution regions with .ANY selector matching etharp.o(.data). ..OutPutTS1106-GTA.axf: Error: L6407E: Sections of aggregate size 0xd4c bytes could not fit into .ANY selector(s). |
|
|
|
是啊,所以要配置合适呢么,根据自己的内存使用情况!
|
|
|
|
请问大哥!这个是由板子的主控芯片通过http协议对PC机发数据吗?
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
如何使用STM32+nrf24l01架构把有线USB设备无线化?
2550 浏览 7 评论
请问能利用51单片机和nRF24L01模块实现实时语音无线传输吗?
2335 浏览 5 评论
3166 浏览 3 评论
2807 浏览 8 评论
为什么ucosii上移植lwip后系统进入了HardFault_Handler?
2768 浏览 4 评论
请教各位大咖:有没有接收频率32M左右的芯片推荐的?先感谢啦!
620浏览 1评论
863浏览 0评论
981浏览 0评论
632浏览 0评论
458浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-29 03:07 , Processed in 1.145839 second(s), Total 63, Slave 57 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号