初级会员

- 积分
- 115
- 金钱
- 115
- 注册时间
- 2013-7-19
- 在线时间
- 15 小时
|
发表于 2018-4-25 12:25:31
|
显示全部楼层
我也在看这个,同样的问题,我是看了源码之后才明白的,在源码提供的例程中关于webserver中:软件资料\uIP学习资料\uIP-1.0源码\apps\webserver:webserver.h文件中有一句话:[mw_shl_code=c,true]#ifndef __WEBSERVER_H__
#define __WEBSERVER_H__
#include "httpd.h"
typedef struct httpd_state uip_tcp_appstate_t;
/* UIP_APPCALL: the name of the application function. This function
must return void and take no arguments (i.e., C type "void
appfunc(void)"). */
#ifndef UIP_APPCALL
#define UIP_APPCALL httpd_appcall
#endif
#endif /* __WEBSERVER_H__ */[/mw_shl_code]这里面重定义了uip_tcp_appstate_t。正确的例子应该是实用这个头文件。
@正点原子
按结构体结构去划分,也是取决于你分配的连续的存储空间足够大,也就是:
最大连接数UIP_CONF_MAX_CONNECTIONS足够大,使得uip_conns[UIP_CONNS](PS:UIP_CONNS = UIP_CONF_MAX_CONNECTIONS )这个数组足够大,就有了连续的存储空间,如果连接数为1,这样程序还能正常运行吗?越界后能确定正常初始化结构体里面的成员数据吗?
|
|