标题: 使用协议栈直接接口实现web服务器 [打印本页]

作者: 51黑黑黑    时间: 2016-2-24 02:17
标题: 使用协议栈直接接口实现web服务器
回调函数的出现,实际上是使用协议栈直接接口实现web服务器的结果。

3步曲:​
一:初始化函数
void httpd_init(void)-->​

二:设置新的连接到达时,调用函数http_accept
static err_t http_accept(void *arg, struct tcp_pcb *pcb, err_terr)-->​

三:当一个TCP段到达这个连接时,调用函数My_http_recv
static err_t My_http_recv(void *arg, struct tcp_pcb *pcb, structpbuf *p, err_t err)

多类似,CC1100的驱动代码呀。
当接收到数据,跳转到中断服务程序去获取CC1100接收到的数据。
回调函数类似中断复位函数。​






欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1